Задайте вопросЗадайте вопрос
 

ОтвеченоError message: Unable to automatically debug service

  • 1 июня 2009 г. 5:06Ken Smith Медали пользователяМедали пользователяМедали пользователяМедали пользователяМедали пользователя
     
    I have a duplex web service (hosted in IIS/Casini) which needs to be called both from Silverlight and from regular .NET code.  Consequently, it's listening on three different endpoints, with three different bindings: the new Silverlight PollingDuplexBindingElement, WSDualHttpBinding, and of course MexHttpBinding for exchanging metadata. 

    I'm using a service factory to create the service like so:

            protected override void InitializeRuntime()
            {
                // Define the binding and set time-outs.
                PollingDuplexBindingElement pdbe = new PollingDuplexBindingElement();


    // Add an endpoint for the given service contract.<br/> this.AddServiceEndpoint( typeof(IRoomService), new CustomBinding( pdbe, new BinaryMessageEncodingBindingElement(), new HttpTransportBindingElement()), "").Behaviors.Add(new SilverlightFaultBehavior()); // This should listen at http://<servername>/services/RoomService.svc/wsdual<br/> this.AddServiceEndpoint( typeof(IRoomService), new WSDualHttpBinding(WSDualHttpSecurityMode.Message), "wsdual");


    this.AddServiceEndpoint( typeof(IMetadataExchange), MetadataExchangeBindings.CreateMexHttpBinding(), "mex");

    base.InitializeRuntime(); }

    Initially, I only had the PollingduplexBindingElement on the service, and everything worked fine.  But then I added the WSDualHttpBinding, and although calls over both bindings seem to work correctly, when I debug the solution from within Visual Studio (using the built-in Cassini web server), I get the following error message after the first web service call:

    "Unable to automatically debug 'SlideLinc.Service'.  The remote procedure could not be debugged.  This usually indicates that debugging has not been enabled on the server.  See help for more information."

    When this message shows up, breakpoints don't get hit, and Debug.WriteLine() messages don't appear in my Visual Studio output window.

    The standard advice for this error message is to make sure that web.config has <compilation debug="true"> in it, which it does:

      <system.web><br/>
        <compilation debug="true"><br/>
          <assemblies><br/>
            <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/><br/>
            <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/><br/>
          </assemblies><br/>
        </compilation><br/>
    </system.web>
    
    The gentleman experiencing a similar problem on this thread here (
    http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/fed739a7-d564-46c1-b2d5-603eb408895a ) turned out to have triggered the problem by calling the MEX portion of the service with an incorrect address.  I'm not doing that, and I double-checked the values at which the endpoints are listening, and to which the calls are being made, and they all seem to be correct.

    I've also seen some suggestions to run various flavors of "
    vsdiag_regwcf.exe -u ", but I'm not interested in making the message go away: I'm interested in actually debugging the service.

    I looked through a service trace with the Microsoft Service Trace Viewer, but I wasn't able to spot any obvious errors.

    It's not an issue with my Visual Studio configuration, as returning to the state of the code before I added the WSDualHttpBinding fixes the problem.

    In other words, the problem appears to show up (for me, at least) when I have two different duplex endpoints bound to the same service.

    Any thoughts or suggestions on how to tackle this?

    Thanks in advance.

    For what it's worth, I'm attaching the relevant portions of the web.config for my service:

      <system.serviceModel>
    
        <!-- ks: aspNetCompatibility is required for sharing state between WCF and ASP.NET -->
    
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
    
        <bindings>
    
        </bindings>
    
        <extensions>
    
          <behaviorExtensions>
    
            <add name="silverlightFaults"
    
                 type="SlideLinc.Service.SilverlightFaultBehavior, SlideLinc.Service, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"/>
    
          </behaviorExtensions>
    
        </extensions>
    
        <behaviors>
    
          <endpointBehaviors>
    
            <behavior name="SilverlightFaultBehavior">
    
              <silverlightFaults />
    
            </behavior>
    
          </endpointBehaviors>
    
          <serviceBehaviors>
    
            <behavior name="SlideLinc.Service.RoomServiceBehavior">
    
              <serviceMetadata httpGetEnabled="true" />
    
              <serviceDebug includeExceptionDetailInFaults="true" />
    
              <dataContractSerializer maxItemsInObjectGraph="2147483646" />
    
            </behavior>
    
          </serviceBehaviors>
    
        </behaviors>
    
        <services>
    
          <service name="SlideLinc.Service.RoomService" behaviorConfiguration="SlideLinc.Service.RoomServiceBehavior" />
    
        </services>
    
        <diagnostics performanceCounters="All" wmiProviderEnabled="true">
    
          <messageLogging logEntireMessage="true" logMalformedMessages="true" logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true" maxMessagesToLog="100000"/>
    
        </diagnostics>
    
      </system.serviceModel>
    
    




    Ken Smith

Ответы

Все ответы