私は、Web サービスを介してサーバーと通信する Metro スタイルのアプリに取り組んでいます。早い段階で、マニフェストに「ホームまたはワーク ネットワーク」(privateNetworkClientServer) および「インターネット クライアント」(internetClient) 機能を追加する必要があることを発見しました。そうしないと、アプリがリモートへの Web サービス呼び出しを試行したときに例外が発生します。ホスト。
ただし、一部のマシンでは、アプリが Web サービスを呼び出そうとすると、次のソケット例外が発生します。
System.ServiceModel.EndpointNotFoundException: There was no endpoint listening at https://[my_service_url] that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. ---> System.Net.WebException: Unable to connect to the remote server
--->
System.Net.Sockets.SocketException: An attempt was made to access a socket in a way forbidden by its access permissions [my_server_ip_address]:443
at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult asyncResult, TransportContext& context)
at System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStreamAsyncResult.CompleteGetRequestStream(IAsyncResult result)
--- End of inner exception stack trace ---
at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result)
at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
at System.ServiceModel.Channels.ServiceChannelProxy.TaskCreator.<>c__DisplayClass5`1.<CreateGenericTask>b__4(IAsyncResult asyncResult)
at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
興味深いことに、共有を無効にすると (wifi 接続を右クリックし、[共有をオンまたはオフにする] を選択し、[いいえ、共有をオンにしたり、デバイスに接続したりしないでください] を選択したりします)、問題は解決し、Web サービスが呼び出されます。成功した。その後、戻って共有をオンに戻すと (「いいえ」ではなく「はい」を選択)、問題が再発します。
したがって、問題はネットワークで共有とデバイスが有効になっているかどうかに関連しているようです。マッピングについては完全にはわかりませんが、これは基本的に「家庭/職場」ネットワークと「公共」ネットワークの違いに帰着すると思います。私の場合、ネットワークが「自宅/職場」の場合、Web サービスの呼び出しは失敗し、ネットワークが「パブリック」の場合は成功しますが、アプリには両方のタイプのネットワーク機能が宣言されており、この問題はすべてのボックスで発生するわけではありません。また、ファイアウォールやその他のネットワーク制限もありません。これは、追加の調整を行わない必要最小限の Win8 インストールです。
最後に、これは Web サービスに分離されたものではありません。同じアプリには、Web サービスとまったく同じ条件下で失敗または成功する iframe があります。