-
Notifications
You must be signed in to change notification settings - Fork 54
Not getting App Insights Requests #6
Comments
Did you also add the WCF service behavior to your service that enables it? This can be done in two ways:
|
I added the ServiceTelemetry attribute to my class. I couldn't figure out how to add it through the config as I have never used a behavior extension before. That attribute fixed it so I am now getting the Request events and they are correctly linked to the Dependency events. Thanks for the quick response! One last question, which may be more app insights than this library, is how can I set the response code for the request event? |
The NuGet package will register the service behavior by default. You'll see something like this in the <extensions>
<behaviorExtensions>
<add name="serviceTelemetry"
type="Microsoft.ApplicationInsights.Wcf.ServiceTelemetryExtensionElement, Microsoft.AI.Wcf"/>
</behaviorExtensions>
</extensions> To add the behavior itself, you need to add the <behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
<!-- Enable Application Insights telemetry-->
<serviceTelemetry/>
</behavior>
</serviceBehaviors>
</behaviors> Of course, if you're using a named behavior, you'll need to add As for your last question, I'm not quite sure what you mean by "setting the response code for the request event". Can you clarify this? By default, the library will notice if your service call returns a fault (that is, throws an unhandled exception or throws an exception derived from FaultException) and will mark the request as failed. If your service is exposed over an HTTP-based binding, we'll also include the HTTP response code in the Request telemetry event. |
I just took by newly created WCF service without App Insights, added the SDK, and set up the instrumentation key.
When I look on the Azure portal, I see Dependency events from when I call into SQL Server, and includes the web service method name, however I get no Request events.
The text was updated successfully, but these errors were encountered: