I'm new to WFC (indigo) so please bear with me for a hopefully dumb question with an easy answer.
I have created a very simple service that is working on my Window XP 64 bit machine just fine with localhost. However, when I move it to a Windows 2003 R2 test box and try to hit it remotely I get the error:
“System.ServiceModel.UnknownFaultException: The request for security token could not be satisfied because authentication failed.”
I'm using January 2006 CTP.
Service Code:
namespace newIndigoTest
{
[ServiceContract(Namespace = "http://xxx.xxx.xxx")]
public interface Iservice2
{
[OperationContract]
string MyOperation1(string myValue);
}
[ServiceBehavior()]
public class service2 : Iservice2
{
public string MyOperation1(string myValue)
{
return "Hello: " + myValue;
}
}
}
.SVC contents
<%@Service language=c# class="newIndigoTest.service2" %>
Web Config:
< xml version="1.0" encoding="utf-8" >
<configuration>
<system.serviceModel>
<services>
<service type="newIndigoTest.service2" behaviorConfiguration="returnFaults" >
<endpoint contract="newIndigoTest.Iservice2" binding="wsHttpBinding" />
</service>
</services>
<behaviors>
<behavior name="returnFaults" returnUnknownExceptionsAsFaults="true" />
</behaviors>
</system.serviceModel>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
Client Code (windows form with a button and a textbox):
Code behind button:
Uri baseAddress = new Uri("http://SomeServerName/SomeVirtualDirectory/newIndigoTest.svc");
WSHttpBinding binding = new WSHttpBinding();
EndpointAddress svcAddress = new EndpointAddress(baseAddress);
ServiceEndpoint httpEndpoint = new ServiceEndpoint(ContractDescription.GetContract(typeof(Iservice2)), binding, svcAddress);
ChannelFactory<Iservice2> factory = new ChannelFactory<Iservice2>(httpEndpoint);
try
{
Iservice2 svc = factory.CreateChannel();
textBox1.Text = svc.MyOperation1("… this is text to prove this thing works.");
}
catch (Exception ex)
{
textBox1.Text = ex.ToString() + Environment.NewLine + ex.StackTrace;
}
I'd appreciate any help with this anyone can provide. The Windows 2003 R2 box does have .Net 2.0 framework installed and the web I'm runnig with is setup to use it and is setup as an application.

how to get WCF to work on Windows 2003 IIS
Morten76
Unless you specifically turn it off, WSHttpBinding will negotiate an SCT for communications. It sounds like you're failing in the RST (Request for Security Token) communication.
Are your client and server machines on the same domain
You can try turning off security if you like:
WSHttpBinding binding = new WSHttpBinding();
binding.Security.Mode = SecurityMode.None;
Or using a cert to identify your client:
WSHttpBinding binding = new WSHttpBinding();
binding.Security.Mode = SecurityMode.Message;
binding.Security.Message.ClientCredentialType = MessageCredentialType.Certificate;
EndpointAddress endptadr = new EndpointAddress("http://localhost:44000/MessageSecurityx509/");
proxy = new GetSomeDataProxy(binding, endptadr);
proxy.ClientCredentials.ClientCertificate.SetX509Certificate(StoreLocation.CurrentUser, StoreName.My, X509FindType.FindBySubjectName, "Darth Scottius");
proxy.ClientCredentials.ServiceCertificate.SetX509Certificate(StoreLocation.CurrentUser, StoreName.TrustedPeople, X509FindType.FindBySubjectName, "localhost");
gsbraun
Thank you. Turning off the security on the binding was the key.
I had to turn it off in the Web config and in the client code.
The addition in the client code was the "binding.Security.Mode = SecurityMode.None" as suggested. I also changed the webconfig as follows.
< xml version="1.0" encoding="utf-8" >
<configuration>
<system.serviceModel>
<services>
<service type="newIndigoTest.service2" behaviorConfiguration="returnFaults" >
<endpoint contract="newIndigoTest.Iservice2" binding="wsHttpBinding" bindingConfiguration="MyBindingConfig" />
</service>
</services>
<bindings>
<wsHttpBinding>
<binding name="MyBindingConfig">
<security mode="None" />
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<behavior name="returnFaults" returnUnknownExceptionsAsFaults="true" />
</behaviors>
</system.serviceModel>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
You notice in the config the addition of the bindingConfiguration attribute and the bindings nodes.
I hope this helps if anyone else is in need of this information.