Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Cannot debug a WCF-Windows Service.

Posted on 2010-11-07
1
Medium Priority
?
1,708 Views
Last Modified: 2012-05-10
Hello,

Our application accesses a WCF service, which is hosted by a Windows Service on a single computer.  The client application and service always will be on the same computer.

I've created a Windows Service that hosts a WCF service.  To test my Windows Service code, I created a console application that contains the same app.config and code as my Windows Service.  I start the console application in one debugging thread, and launch my client in another debugging thread.  Everything works perfectly and I can easily use the debugger.

Now the rub...

So, I created an installer and installed my Windows Service.  After successfully starting it, I successfully added the Service Reference to my client using http://localhost/VssService within Visual Studio 2010.  I successfully attached to the service via "Attach To Process".  I launched my client in a debugging thread, but when I try to step into a remote method, I get "Unable to automatically step into the server.  The debugger failed to stop in the server process."  This happens for both [NetNamedPipeBinding_IVssService] and [BasicHttpBinding_IVssService].  I have been struggling with this for hours and have run out of ideas, so I hope that you can help me.  I've included the app.config files for my Windows Service and Client application. Hopefully they will help.

I appreciate your taking time to read this question and hope that you can help be to resolve this problem...

Mike



===================== SERVICE APP.CONFIG =============================
<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.serviceModel>
      
        <services>
            <service behaviorConfiguration="VssServiceBehavior" name="ClientSaver.VssService.VssService">
                <endpoint address="net.pipe://localhost/VssService/Pipe/" binding="netNamedPipeBinding"
                    bindingConfiguration="" contract="ClientSaver.VssService.IVssService" />
                <endpoint address="http://localhost/VssService/" binding="basicHttpBinding"
                    bindingConfiguration="" contract="ClientSaver.VssService.IVssService" />
                <endpoint address="http://localhost/VssService/MEX/" binding="mexHttpBinding"
                    bindingConfiguration="" contract="IMetadataExchange" />
                <host>
                    <baseAddresses>
                        <add baseAddress="http://localhost/VssService/" />
                    </baseAddresses>
                </host>
            </service>
        </services>

      <behaviors>
        <serviceBehaviors>
          <behavior name="VssServiceBehavior">
            <serviceMetadata httpGetEnabled="True" policyVersion="Policy15" />
            <serviceDebug includeExceptionDetailInFaults="False" />
          </behavior>
        </serviceBehaviors>
      </behaviors>      
    </system.serviceModel>
</configuration>
=======================================================


========================= CLIENT APP.CONFIG =============================
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.web>
    <compilation debug="true" />
  </system.web>
  <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="BasicHttpBinding_IVssService" closeTimeout="00:01:00"
                    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                    allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                    maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                    messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                    useDefaultWebProxy="true">
                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    <security mode="None">
                        <transport clientCredentialType="None" proxyCredentialType="None"
                            realm="" />
                        <message clientCredentialType="UserName" algorithmSuite="Default" />
                    </security>
                </binding>
            </basicHttpBinding>
            <netNamedPipeBinding>
                <binding name="NetNamedPipeBinding_IVssService" closeTimeout="00:01:00"
                    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                    transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
                    hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288"
                    maxBufferSize="65536" maxConnections="10" maxReceivedMessageSize="65536">
                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    <security mode="Transport">
                        <transport protectionLevel="EncryptAndSign" />
                    </security>
                </binding>
            </netNamedPipeBinding>
        </bindings>
        <client>
            <endpoint address="net.pipe://localhost/VssService/Pipe/" binding="netNamedPipeBinding"
                bindingConfiguration="NetNamedPipeBinding_IVssService" contract="VssService.IVssService"
                name="NetNamedPipeBinding_IVssService">
                <identity>
                    <servicePrincipalName value="host/DEVPC_W7.aboh.local" />
                </identity>
            </endpoint>
            <endpoint address="http://localhost/VssService/" binding="basicHttpBinding"
                bindingConfiguration="BasicHttpBinding_IVssService" contract="VssService.IVssService"
                name="BasicHttpBinding_IVssService" />
        </client>
        <services>
            <service name="ClientSaver.VssService.VssService">
                <endpoint address="net.pipe://localhost" binding="netNamedPipeBinding"
                    bindingConfiguration="" contract="ClientSaver.VssService.IVssService" />

                <endpoint address="http://localhost/VssService/" binding="basicHttpBinding"
                    bindingConfiguration="" contract="ClientSaver.VssService.IVssService" />                            
            </service>
        </services>

      <behaviors>
        <serviceBehaviors>
          <behavior name="VssServiceBehavior">
            <serviceMetadata httpGetEnabled="true" policyVersion="Policy15" />
            <serviceDebug includeExceptionDetailInFaults="true" />
          </behavior>
        </serviceBehaviors>
      </behaviors>      
    </system.serviceModel>
</configuration>

Open in new window

0
Comment
Question by:mjgardne
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

by:
mjgardne earned 0 total points
ID: 34088722
I found that if I do the following, I can debug my service:

1) set a breakpoint in the service code;
2) attaching to its process;
3) running my application in a separate debugger thread

Run my application until it hits the breakpoint... Don't try to step into the service code... Won't work...
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question