ホスティングプロバイダーでホストされている2つのWCFサービスがあります。どちらのサービスも正常に機能します。自分のコンピューターから、または別のプロバイダーでホストされているWebサイトからでもアクセスできます。奇妙な部分(少なくとも、私が理解していない部分)は次のとおりです。一方が他方を呼び出すことはできません。
両方のサービスは、同じ階層レベルのWebルートのサブフォルダーにあります。wwwroot\serviceoneやwwwroot\servicetwoのように。両方ともIISでアプリケーションフォルダとしてマークされています。どちらも以下に示すようにほぼ同様のweb.configを持っていますが、名前だけが異なります。
<configuration>
<system.web>
<compilation targetFramework="4.0" />
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="servone">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<services>
<service name="MyService.ServiceOne" behaviorConfiguration="servone">
<endpoint address="" binding="basicHttpBinding" contract=" MyService.IServiceOne "/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
.svcを参照すると、サンプルコードを含む既知のサービスページが表示されます。
class Test
{
static void Main()
{
ServiceOne client = new ServiceOne ();
// Use the 'client' variable to call operations on the service.
// Always close the client.
client.Close();
}
}
クライアントには、HandleRequest(string str)という名前のメソッドがあります。したがって、私のコード(C#)には、次のような行があります。
client.HandleRequest("blah");
呼び出しによって例外が発生することはありません(キャッチされ、処理され、データベースに書き込まれるため、わかります)。メッセージは送信されますが、返されません。このサービス(他のサービスを呼び出す)をローカルで実行し、2番目のサービスをリモートサーバーに残すと、すべて正常に機能します。
明らかに、ホスティングパーティからすべての詳細を提供することは困難です。残念ながら、環境をシミュレートするためのIISインストールにアクセスすることもできません。ですから、私が提供できるわずかな情報に基づいた詳細な技術的解決策は期待していません。ただし、この設定が他のすべての設定とどのように異なるかについてのコメントは役立つ場合があります。
本当にありがとうございました。
編集:
呼び出しは次のように行われます。
public bool Send(String str)
{
bool result = false;
BasicHttpBinding binding = new BasicHttpBinding();
EndpointAddress ep = new EndpointAddress("http://www.mydomain.com/ServiceTwo.svc");
client = new ServiceTwoClient(b, ep);
//
try
{
result = client.HandleRequest(str);
client.Close();
return result;
}
catch (Exception x)
{
Add2DbLog(x.Message);
return false;
}
}