0

My project is based on a WCF Web Service, and whilst debugging, it's launching the WCF Test Client. When I come across an error, rather than breaking in code at the particular point, it's just reporting the error back to the WCF Test Client.

I'd like it to break in code, so I can debug and watch which records it's breaking on. This used to happen, but suddenly it stopped working. I don't know if it's something I've disabled in web.config.

The Project Web Server is still set to IIS Express (localhost:#####), and I have other projects using the WCF Test Client, which are breaking in code just fine.

<?xml version="1.0"?>
<configuration>

  <configSections>
    <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
      <section name="ConnectorService.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    </sectionGroup>
  </configSections>
  <appSettings>
     <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime requestValidationMode="2.0" targetFramework="4.5"/>
  </system.web>
  <system.serviceModel>
    <behaviors>

      <serviceBehaviors>
        <behavior>
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>

    </behaviors> 
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <directoryBrowse enabled="true"/>
  </system.webServer>

  <applicationSettings>
    <ConnectorService.Properties.Settings>
      <setting name="ConnectionName" serializeAs="String">
        <value>Test</value>
      </setting>
      <setting name="UserName" serializeAs="String">
        <value>TestUser</value>
      </setting>
      <setting name="Password" serializeAs="String">
        <value>Password</value>
      </setting>
    </ConnectorService.Properties.Settings>
  </applicationSettings>
</configuration>

I have no idea what it could be, if I can provide more info, just ask, thanks.

Mark
  • 315
  • 2
  • 8
  • 24

3 Answers3

0

Well! If you are making REST services, then Fidler is a good option.

  1. Always use Logging mechanism. Like when ever an exception is raised, make a file and place log details in that file in catch block.

  2. To debug, one option is attach to process option in Visual Studio. In Menu bar, Go to Debug, then Attach to process... and select an appropriate process (might be Fiddler).

  3. Another option is, make another project (Client Project) in same WCF Solution. Make sure your client project uses your WCF Services. Now Right Click on your solution, click Set StartUp Project..., check Radio Button Multiple startup projects..., and from your project list, select Action to Start.

  4. After doing that, Run your project with break point in your WCF code that you want to debug and then execute your client. When a request will be made, it will hit break point. Make sure you are running in Debug mode.

See this answer.

Community
  • 1
  • 1
Faizan Mubasher
  • 4,427
  • 11
  • 45
  • 81
0

Make sure that when you launch your client, attach it to the debugger. Here is how to attach a process to the debugger.

Toan Nguyen
  • 11,263
  • 5
  • 43
  • 59
  • I can't attach to the WCF Test Client, because it already is. I may have not made it very clear. If I have a breakpoint, it breaks on that just fine, but it won't break where I don't have one - only reporting the error back to the WCF Test Client. All I'm doing is running Debug inside Visual Studio, which is calling WCF Test Client, as my .svc file is set as default. – Mark Feb 13 '14 at 15:24
  • 1
    @Mark Try to enable exception catching for Visual Studio. Go to Debug menu item on the top of visual studio, and then go to Exceptions. next, check Common Language Runtime Exceptions. Finally, try again. This should break when an exception is raised – Toan Nguyen Feb 13 '14 at 19:17
0

I realize this is a very old question but I believe this is caused by this setting in web.config: aspNetCompatibilityEnabled="true"

Crob
  • 599
  • 4
  • 26