1

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
4

1 に答える 1

1

コマンド ライン プロンプトから「NETSTAT -ano」を使用して、指定したポートでサービスがリッスンしていることを確認します。それが確認されたら、クライアント ボックスからサービス ボックスの IP を PING してみてください。どちらも成功する場合は、ファイアウォールやネットワーク スイッチの構成に問題がある可能性があります。

于 2013-01-18T22:22:47.237 に答える