私は、開発で正常に動作する WCF Web サービスとアプリケーションを持っています。IIS サーバーで WCF を公開し、サーバー名でアドレス指定されたファイアウォール内の Web アプリから使用できます。ただし、外部で使用するために出したので、問題が発生しています。
Web アプリが接続しようとするとエラーが発生します。サービス、disco、wsdl などをファイアウォールの内側と外側から見ることができますが、外側から認証の最初の呼び出しを行うと、サービスは認証メソッドの呼び出しを処理する代わりに DISCO ページを返します。私が理解しているように、アプリはhtmlではなくxmlを期待しているため、これによりProtocolExceptionが発生します。
繰り返しますが、まったく同じ Web アプリが、IIS サーバーに内部的にヒットして正常に動作します。違いの 1 つは、外部的には Web アドレスから取得していることですが、内部的にはサーバー名を使用しています。ただし、サービスは、Web アドレスを使用してファイアウォールの外側の Web ブラウザーに読み込まれます。
部分的な Web アプリ構成:
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding
name="WSHttpBinding_IWebService"
closeTimeout="00:03:00"
openTimeout="00:03:00"
receiveTimeout="00:10:00"
sendTimeout="00:03:00"
bypassProxyOnLocal="false"
transactionFlow="false"
hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="5000000"
maxReceivedMessageSize="5000000"
useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="5000000"
maxArrayLength="5000000"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Message">
<transport
clientCredentialType="Windows"
proxyCredentialType="None"
realm="" />
<message
clientCredentialType="Windows"
negotiateServiceCredential="true"
algorithmSuite="Default"
establishSecurityContext="true"
/>
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://<dns address/server address>/WebService.svc"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IWebService"
contract="WebServiceRef.IWebService" name="WSHttpBinding_IWebService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint
address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</client>
部分的なサービスの web.config ファイル:
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding
name="ServiceBinding"
openTimeout="00:03:00"
sendTimeout="00:03:00"
transactionFlow="false"
maxBufferPoolSize="5000000"
maxReceivedMessageSize="5000000">
</binding>
</wsHttpBinding>
</bindings>
<services>
<service
behaviorConfiguration="xxx.WebServiceBehavior"
name="xxx.WebService">
<endpoint
address="http://<dns address/server address>/WebService.svc"
binding="wsHttpBinding"
bindingConfiguration="ServiceBinding"
contract="xxx.IWebService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint
address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>
<behaviors>
/WebService.svc"/>