IIS 7.5 と 1 つの IP を備えた Windows 2008 Server を使用しています。ルートの下には、/web と /service の 2 つのアプリケーションがあります。/web は MVC4 アプリケーションで、/service は WCF 4.0 サービスです。
MVC からサービスを利用するときは、次のコードを使用します。
// Create the web request
HttpWebRequest request = WebRequest.Create(TripServiceUrl + id) as HttpWebRequest;
// Get response
using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
{
// Get the response stream
StreamReader reader = new StreamReader(response.GetResponseStream());
// Console application output
tripJson = reader.ReadToEnd();
}
次の SocketException が発生します。
[SocketException (0x274c): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 10.243.6.43:80]
System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) +273
System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception) +584
ただし、サーバーのブラウザーから 10.243.6.43:80 (内部アドレス) を確認でき、サービスを正常に呼び出すことができます。IP はパブリックにアクセスできません。
そのような自己参照呼び出しを機能させるには、どのような構成を行う必要がありますか?