WSHttpBinding を使用して WCF サービスを作成しました。
ServiceHost svh = new ServiceHost(typeof(MyService));
var httpLocation = "http://" + address + ":4041";
svh.AddServiceEndpoint(typeof(IMyService), new WSHttpBinding(SecurityMode.None), httpLocation);
svh.Open();
そして、私はそれをシステムに登録しました
netsh http add urlacl url=http://+:4041/ user=username
ローカルホストから接続しようとすると、サービスが機能します。
しかし、それを別の PC (address='localhost' または address='ip-of-the-machine') に配置すると、次の例外で接続が失敗します。
There was no endpoint listening at http://192.168.44.128:4041/ that could accept
the message. This is often caused by an incorrect address or SOAP action. See
InnerException, if present, for more details.
内部例外:
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 192.168.44.128:4041
サービスをファイアウォールに追加しようとしましたが、役に立ちませんでした。
ここで何が問題なのですか?
アップデート
からの関連エントリを次に示しnetstat -ano
ます。1 つ目は外部から接続できない http エンドポイントで、2 つ目は正常に動作する net.tcp エンドポイントです。
TCP [::]:4041 [::]:0 LISTENING 4
TCP 192.168.44.128:9939 0.0.0.0:0 LISTENING 2120