Is there a way to disable WCF Service debugging in VS 2010?
I have an ASP.NET webforms app that is consuming a third party service via a WCF service proxy that I created in Visual Studio 2010 with the Add Service Reference command.
I have added several public methods to the generated Client class in a separate partial class definition so that they persist even if I regenerate the proxy. These methods are what the rest of my code calls instead of directly calling the proxy methods that map to the api calls.
The problem I run into is when I need to debug the methods I have added. When I place a breakpoint in one of the methods I created and then attempt to开发者_如何学C Step Over or Step Into the code, Visual Studio hangs for some time and then returns with the following error:
Unable to automatically step into the server. Connecting to the server machine '[address of service]' failed. The debugger cannot connect to the remote computer. This may be because the remote computer does not exist or a firewall may be preventing communication to the remote computer. Please see Help for assistance.
After this error occurs Visual Studio automatically Steps Out of the method I was debugging, preventing me from debugging my client-side code.
Visual Studio is attempting to connect to the remote 3rd party service to try and debug it. However, I have no control over this service and will never have access to let it do this.
Is there any way to tell Visual Studio to not attempt to debug this remote service and just debug the client-side code?
UPDATE
I was looking at the code of the generated Client, and I saw that it has the DebuggerStepThroughAttribute applied to it, so I guess that explains the problem I was having with it not letting me Step Into my code, but it still doesn't solve the larger issue of preventing VS from trying to debug the remote service.
I think Visual Studio has the WCF service host behavior built in for WCF Library projects now. As far as I can tell the only way to turn it off is to change the project type back to a normal Library. You can do that by editing the .csproj manually: remove {349c5851-65df-11da-9384-00065b846f21}
(and the associated semicolon) from <ProjectTypeGuids>
.
精彩评论