WCFサービスを作成し、IIS7 / WindowsServer2008でホストしました。アプリケーションでサービスを利用しようとしています...VisualStudio(デバッグ)からアプリケーションを実行すると、サービスとすべてを呼び出すことができます。期待どおりに動作しますが、公開されたアプリケーションからサービスを呼び出そうとすると、上記のエラーが発生します。
サービスのweb.configは次のとおりです。
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<connectionStrings>
...
</connectionStrings>
<system.web>
<compilation debug="false" />
</system.web>
<runtime>
<generatePublisherEvidence enabled="false"/>
</runtime>
<system.serviceModel>
<services>
<service name="SVCLIB.SERVICE1">
<endpoint address="" binding="wsHttpBinding" contract="SVCLIB.SERVICE1">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8732/Design_Time_Addresses/SVCLIB/SERVICE1/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
そしてクライアントで:
SERVICE1.SERVICE1Client objService = new SERVICE1Client();
objService.ClientCredentials.Windows.ClientCredential.UserName = "UserName";
objService.ClientCredentials.Windows.ClientCredential.Password = "Password";
objService.GetData();
objService.Close();
VSでアプリケーションをデバッグする場合は機能しますが、公開されたアプリケーションを実行する場合は機能しません。
エラー:
認証に失敗したため、セキュリティトークンの要求を満たすことができませんでした
Stack Overflowなどに関する多くの投稿を見てきましたが、これまでのところ何も役に立ちませんでした。
ありがとうございました!
** 編集:
これは、クライアント側のweb.configにあります。
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_SERVICE1" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text"
textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
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" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://server.samedomain.com:8000/SVCLIB.SERVICE1.svc"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_SERVICE1"
contract="SERVICE1.ISERVICE1" name="WSHttpBinding_ISERVICE1">
</endpoint>
</client>
</system.serviceModel>
以下のGmailユーザーの提案とリンクを試しました...しかし、それでも同じ問題があります。同じエラー。