0

ローカルで適切に実行されている C# WCF サービス ライブラリがあります。ローカルで実行されているクライアントは、サービスを確認して使用することができました。しかし、WebRole でサービスをホストして Azure にデプロイしようとしたとき、クライアントはローカルと同じように正常に接続できませんでした! 私が行った方法は次のとおりです。

// The WCF Service library is in namespace: Root.Library    
Uri url = new Uri("http://xxx.cloudapp.net:8099/DealerService"); // tried also without "DealerService" but still didn't work
ServiceHost host = new ServiceHost(typeof(Root.Library.DealerService), url));
host.AddServiceEndpoint(typeof(Root.Library.IDealerService), new WSHttpBinding(), "DealerService");

ServiceMetadataBehavior dealerMetaBehavior = new ServiceMetadataBehavior();
dealerMetaBehavior.HttpGetEnabled = true;
host.Description.Behaviors.Add(dealerMetaBehavior);

host.Open();

Root.Library 内の app.config:

<service name="Root.Library.DealerService">
    <endpoint address="" binding="wsHttpBinding" name="dealer" contract="Root.Library.IDealerService">
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" name="mex" contract="IMetadataExchange" />
    <host>
      <baseAddresses>
        <add baseAddress="http://xxx.cloudapp.net:8099/" />
      </baseAddresses>
    </host>
  </service>

また、エンドポイントを WebRole 構成に追加しました (Type:Input、Protocol:http、PublicPort:8099)。

誰かが問題が何であるか教えてもらえますか??? これは本当に私を混乱させます!

どうもありがとう!

4

1 に答える 1

0

csdefファイルに基づいてポートを変更できるはずです

<Endpoints>
  <InputEndpoint name="Endpoint1" protocol="http" port="8888" />
</Endpoints>

Saqib Ullah がgeekswithblogsに投稿して、詳細を示しています。

于 2012-07-31T05:33:21.070 に答える