Platform: VS 2008, .NET 3.5, C #, Oracle 11g
I created a WCF service that takes some data items and then inserts them into a database table and returns an integer. I also created a small ASP.NET web application to test this service. In the test web application, there is only a page with fields and a button, clicking this button actually calls the web service to insert data and return an integer value.
The steps I took:
- Create a WCF Service
- Publish WCF Service
- Generate proxy class (.cs) and app.config using svcutil
- Create an asp.net test application and add the proxy settings and configurations that you created in the previous step.
- Destroy test application
It works great when I deploy both WCF and a test web application on my computer - Windows XP, IIS 5.1. But, when I try to deploy them to a remote server, this will not work. When I try to use a service (deployed on a remote server - Windows 2003 server, IIS 6), I get the following error:
The request for the security token cannot be satisfied because the authentication failed.
Description: An unhandled exception occurred during the execution of the current web request. View the stack trace for error information and where it originated in the code.
Exception Details: System.ServiceModel.FaultException: The security token request could not be satisfied because authentication failed.
The following is a list of .config files:
wcf section in Web.Config to invoke ASP.NET web application (Consumer):
<system.serviceModel> <bindings> <wsHttpBinding> <binding name="WSHttpBinding_IMyWCFService" 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" establishSecurityContext="true" /> </security> </binding> </wsHttpBinding> </bindings> <client> <endpoint address="http://57.23.85.28:8001/MyWCFService/MyWCFService.svc" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IMyWCFService" contract="IMyWCFService" name="WSHttpBinding_IMyWCFService"> <identity> <dns value="localhost" /> </identity> </endpoint> </client> </system.serviceModel>
Web.Config WCF:
<configuration> <connectionStrings> <add name="DSMyWCF" connectionString="Data Source=XXX;User id=XXX;Password=XXX;"/> </connectionStrings> <system.web> <compilation debug="true" /> </system.web> <system.serviceModel> <services> <service behaviorConfiguration="MyWCFService.MyWCFServiceBehavior" name="MyWCFService.MyWCFService"> <endpoint address="" binding="wsHttpBinding" contract="MyWCFService.IMyWCFService"> <identity> <dns value="localhost" /> </identity> </endpoint> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> <host> <baseAddresses> <add baseAddress="http://localhost:8731/Design_Time_Addresses/MyWCFService/MyWCFService/" /> </baseAddresses> </host> </service> </services> <behaviors> <serviceBehaviors> <behavior name="MyWCFService.MyWCFServiceBehavior"> <serviceMetadata httpGetEnabled="True"/> <serviceDebug includeExceptionDetailInFaults="False" /> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel> </configuration>
source share