views:

205

answers:

2

I have a series of svc files within a web application, they all worked fine but I have a need to run with aspNetCompatibilityEnabled set to true and now I get the following exception

System.ServiceModel.ServiceActivationException: The requested service, '...' could not be activated. See the server's diagnostic trace logs for more information.

Where are these trace logs that it talks about and what could be causing this?

Thanks

A: 

You could activate extensive logging information by adding the following to your web.config:

<system.diagnostics>
  <trace autoflush="true">
    <listeners>
    </listeners>
  </trace>
  <sources>
    <source name="System.ServiceModel"
            switchValue="Information, ActivityTracing"
            propagateActivity="true">
      <listeners>
        <add name="sdt"
             type="System.Diagnostics.XmlWriterTraceListener"
             initializeData= "WcfDetailTrace.txt" />
      </listeners>
    </source>
  </sources>
</system.diagnostics>

Then you could use SvcTraceViewer.exe to view the log file

Darin Dimitrov
A: 

So when turning aspNetCompatibilityEnabled to true, you need to apply changes in a couple of places. Firstly, i'm guessing you've done it in your web.config file. Secondly, you'll need to apply changes to services by decorating the service classes with AspNetCompatibilityRequirements attributes:

C#

[AspNetCompatibilityRequirements(
    RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class MySampleService
{

}

VB

<Activation.AspNetCompatibilityRequirements( _
RequirementsMode:=Activation.AspNetCompatibilityRequirementsMode.Allowed)> _
public class MySampleService 

End Class

You can, if all services allow it, decorate a base service class with this attribute so it's inherited by all services by default.

Tanner