2016-03-25 13 views
0

無効なURIによって次のエラーが発生して、あるデバイスでアプリがクラッシュすることがあります:無効なポートが指定されています。現在のdomain_UnhandledExceptionのスタックトレースをキャッチできません。

問題は、特定の方法でこれが発生することがわかりません。ドイツの一部のネットワークエリアでは、1台のデバイスでしかクラッシュしません。スタックトレースは次のメッセージだけを表示しています:

Current domain_UnhandledException. Stack trace: System.UriFormatException: Invalid URI: Invalid port specified. 
    at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind) 
    at System.Uri..ctor(String uriString) 
    at HttpServer.HttpClientContext.OnRequestLine(Object sender, RequestLineEventArgs e) 
    at System.EventHandler`1.Invoke(Object sender, TEventArgs e) 
    at HttpServer.Parser.HttpRequestParser.OnFirstLine(String value) 
    at HttpServer.Parser.HttpRequestParser.Parse(Byte[] buffer, Int32 offset, Int32 count) 
    at HttpServer.HttpClientContext.OnReceive(IAsyncResult ar) 
    at System.Net.LazyAsyncResult.Complete(IntPtr userToken) 
    at System.Net.ContextAwareResult.CompleteCallback(Object state) 
    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) 
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) 
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) 
    at System.Net.ContextAwareResult.Complete(IntPtr userToken) 
    at System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr userToken) 
    at System.Net.Sockets.BaseOverlappedAsyncResult.CompletionPortCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped) 
    at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP) 

クラッシュソースを見つけるにはどうすればよいですか?新しい詳細を発見

+0

私たちはあなたのソースコードを参照する必要があり、問題を引き起こしている実際のポート番号(エラーメッセージの件名)。 –

+0

クラッシュは 'HttpServer.HttpClientContext.OnRequestLine'にあり、無効なURIを作成しようとします。さて、どのHttpServerはここで話していますか? 'HttpClientContext'プロパティは含まれていないので、' System.Web.Http'に 'HttpServer'を置くことはできません。どのプラットフォームがあなたのコードを実行しているのですか、どのようなアプリケーションですか? –

+0

wpfプレーヤーのサービスとして働いている巨大なAppであるため、ソースコードは役に立ちません。 アプリケーションはx86で、Windows 7で動作しています。 問題はアセンブリHttpServer.dll、v1.0.0.0にあると思われます –

答えて

0

https://github.com/duplicati/httpserver/blob/master/HttpServer/HttpClientContext.cs

private void OnRequestLine(object sender, RequestLineEventArgs e) 
     { 
      _currentRequest.Method = e.HttpMethod; 
      _currentRequest.HttpVersion = e.HttpVersion; 
      _currentRequest.UriPath = e.UriPath; 
      // Initialize _currentRequest.Uri to a synthesized path. This will be the final value if the host header is not sent 
      string authority = _localEndPoint.Address.ToString(); 
      if (_localEndPoint.Port != 80) authority += ":" + _localEndPoint.Port; 
      _currentRequest.Uri = new Uri((IsSecured ? "https://" : "http://") + authority + e.UriPath); 
     } 
+0

このコードは問題の可能性があるIPv6アドレスで失敗します。 IPv6アドレスの場合、このコードではできないポート番号を含めるには、アドレス部分を角カッコ[]で囲む必要があります。 –

+0

良いアイデア!私のHttpListenersが動的に作成されている場合、どうすればこの問題を回避できますか?(( –

+0

)著者に連絡して自分の気になるコードを修正したり、トンネルで、IPv6に関してアプリケーションが壊れていることを説明します。それを超えるものは、アプリケーションのロジックを書き直す必要がありますが、このサイトの範囲を少し超えています。 –

関連する問題