Hi guys, I have a Console application hosting a WCF service:
Updated this code to run off the app.config file instead of initialising it programatically
Uri baseAddress = new Uri("http://localhost:8000/ChatServer/Service");
ServiceHost myHost = new ServiceHost(typeof(ClientServerChat.ChatServer), baseAddress);
myHost.AddServiceEndpoint(typeof(IChat), new WSHttpBinding(), "ChatService");
ServiceMetadataBehavior mb = new ServiceMetadataBehavior();
ServiceBehaviorAttribute attrib = (ServiceBehaviorAttribute)myHost.Description.Behaviors[0];
attrib.IncludeExceptionDetailInFaults = true;
mb.HttpGetEnabled = true;
myHost.Description.Behaviors.Add(mb);
myHost.Open();
The Console app compiles and runs. svcutil runs perfectly.
Svcutil runs against the new service code perfectly and generates the Client code and the ouput file
I'm calling svcutil via the Visual Studio Command Prompt like so: svcutil.exe http://localhost:8000/ChatServer/Service
It generates this output.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IChat" 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://localhost:8000/ChatServer/Service/ChatService"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IChat"
contract="IChat" name="WSHttpBinding_IChat">
<identity>
<userPrincipalName value="Bedroom-PC\Roberto" />
</identity>
</endpoint>
</client>
</system.serviceModel>
</configuration>
Along with the bundled client code (which is in the same directory as the output file, I should add) I should be able to call the service with this:
ChatClient client = new ChatClient();
The new output from svcutil (both code and config) still throws this exception.
But it throws an exception saying:
"Could not find default endpoint element that references contract 'IChat' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element."
Interestingly, Visual Studio 2008 will crash when adding the same Service reference to a Client project.
VS2008 still crashes with the updated code.
It will find the service, get all the operations and what not. When I click Add, it crashes.
Any one have a clue whats going on??
Thanks in advance
Roberto