I have a WCF Library hosted by IIS 6 and it all works fine. However I need to step through the code in the service. But when I hit F5 in VS2008 I get the following error message. . .
A binding instance has already been associated to listen URI 'http://localhost:8888/VtaxDataService'. If two endpoints want to share the same ListenUri, they must also share the same binding object instance.
nothing else on my machine is listening on that URI. I thought the message might be referring to the website hosting my service but I stopped the web site in IIS and I still get the message. My app.config is pasted below.
What is the problem and how can I step through this code?
<messageLogging logMalformedMessages="true" logMessagesAtServiceLevel="true"
<endpoint address="" binding="wsHttpBinding" contract="VtaxDataService.IVtaxDataService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<endpoint binding="basicHttpBinding" contract="VtaxDataService.IVtaxDataService" />
<add baseAddress="http://localhost:8877/VtaxDataService" />
<!-- To avoid disclosing metadata information,
set the value below to false and remove the metadata endpoint above before deployment -->
<!-- To receive exception details in faults for debugging purposes,
set the value below to true. Set to false before deployment
to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="False" />
Your WCF service is already hosted in IIS 6 and listening at http://localhost:8877/VtaxDataService. When you run service from Visual Studio it hosts the service in WcfSvcHost.exe and tries to listen at above endpoint and you receive error.
To debug the service you can remove your service from IIS and debug from WcfSvcHost.exe. Otherwise, do not run service, add breakpoint and attach process to aspnet_wp.exe (ASP.NET worker process).
For more information on attaching to running process see: http://msdn.microsoft.com/en-us/library/c6wf8e4z.aspx
- Proposed as answer by Jaydeep Kher Monday, November 03, 2008 2:19 AM
None of this works:
I stopped IIS then ran the WCF service from Visual studio and still got the error message about endpoints sharing the listenuri.
With IIS back on I brought up a new instance of vs2008, there was no service "aspnet_wp.exe" or anything like it.
I then attached to my wcf service in visual studio with breakpoints set in the source. Running the client the breakpoints were never tripped - just ran through them.
Your link tells how to attach to a process but has nothing about actually debugging.
I googled around for a couple of hours and found content that talked around debugging via attaching to processes but nothing about WCF.
So, I am unable to debug the WCF service at this point.
Yes, of course it does. But my question is "why am I getting this 'http://localhost:8888/VtaxDataService'. If two endpoints want to share the same ListenUri, they must also share the same binding object instance." error message when IIS is even shut down.
It seems once you host a WCF Library in IIS you are no longer able to debug it.
So my basic question I am seeking a straight answer to on this forum is:
"how can I step through code in a WCF Library application that is hosted by IIS"
If the answer to that question is : "you can't" then the question would be:
"What do I have to do to accomplish debugging?" Stopping IIS did not do the trick.
Just as your code shown, service can host multiple endpoints, each with different addresses and possibly also different bindings. You'd better to change the address for each endpoint.
If you want to have more info about how to host multiple endpoints at the same address, please refer to thread under http://msdn.microsoft.com/en-us/library/aa395210.aspx