Giter VIP home page Giter VIP logo

Comments (3)

tomasr avatar tomasr commented on May 18, 2024

Did you also add the WCF service behavior to your service that enables it? This can be done in two ways:

  • Code: Adding the [Microsoft.ApplicationInsights.Wcf.ServiceTelemetry] attribute to your service definition class.
  • Configuration: Add the <serviceTelemetry/> behavior through config. The NuGet package will register the behavior in <behaviorExtensions/> but it will not modify any existing service behavior definitions automatically at this time.

from applicationinsights-sdk-labs.

SharpDude avatar SharpDude commented on May 18, 2024

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?

from applicationinsights-sdk-labs.

tomasr avatar tomasr commented on May 18, 2024

The NuGet package will register the service behavior by default. You'll see something like this in the <system.serviceModel> section of your web.config file:

<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 <serviceTelemetry/> tag to a Service Behavior. If you're using mostly doing the default configuration that Visual Studio generates for WCF services, you should have an unnamed service behavior where you could add it, and it would look something like this:

<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 <serviceTelemetry/> to the right one :).

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.

from applicationinsights-sdk-labs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.