简体   繁体   中英

How to debug a WCF Service Application?

Newbie question. In vs2010 (.net 4.0), I used the WCF Service Application template to create a Web Application. This was then published using Web Deploy to IIS 7 residing on the same box as my client application.

How can the WCF Service Application be debugged?

I have tried this:

  1. Set a breakpoint in the Service1.svc.cs code.
  2. Recompile all with a debug configuration. Build target is to bin\\
  3. Publish the WCF Service Application project to the local IIS7 website.
  4. Start the client application which calls the IIS7 WebSite.
  5. Start a second instance of VS2010 in administrative mode and Attach to process w3wp.exe.
  6. return to the first instance of vs and execute the method that has the breakpoint set.

Bringing back up the second instance of vs (the one that is attached), only shows "Disassembly cannot be displayed in run mode".

What did I miss? Is there a better way?

Any help or suggestions would be most appreciated.

Edit #1: I added debugging to the web.config, as:

 <system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<behaviors>
  <serviceBehaviors>
    <behavior>
          <serviceMetadata httpGetEnabled="true"/>
           <serviceDebug httpHelpPageEnabled="true" includeExceptionDetailInFaults="true" />
    </behavior>
  </serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>

Still no luck??

Edit #2: In running the web service application project directly in its own instance of vs, I get

"The Web project "WCFServiceApplication0" is currently configured to use the URL "http:/localhost:8999/WCFServiceApplication0". The Web server has this URL mapped to a different folder "C:\\Nova5\\WCFServiceApplication0_deploy". Would you like to remap this URL to point to the Web project's folder?"

How should this be answered? And how did a *_deploy folder get made? Thank you for your consideration.

You can directly debug your WCF service.

VS(Run as Adminstrator) -> Open the Wcf Project -> Properties -> Web -> Point to the VirtualDirectory of IIS.

Then Right click the Svc.cs -> Debug as New instance.

If you have mulitiple hostable Projects in Solution Like 1 Web and 1 Wcf, then set Multiple StartUp Project from Solution -> Set StartUp project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM