Commit a7928b2a authored by kaanid's avatar kaanid Committed by Lemon

asp.net Exclude OPTIONS request && sample asp.net skywalking.json (#118)

parent 53836aac
......@@ -118,6 +118,9 @@
<Name>SkyWalking.AspNet</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="skywalking.json" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\..\packages\Grpc.Core.1.12.0\build\net45\Grpc.Core.targets" Condition="Exists('..\..\packages\Grpc.Core.1.12.0\build\net45\Grpc.Core.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
......
......@@ -7,10 +7,6 @@ http://www.mono-project.com/Config_system.web and
http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx
-->
<configuration>
<appSettings>
<add key="ApplicationCode" value="aspnet-sample"/>
<add key="DirectServers" value="localhost:11800"/>
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5">
<assemblies />
......
{
"SkyWalking": {
"ApplicationCode": "SkyWalking.Sample.AspNet",
"SpanLimitPerSegment": 300,
"Sampling": {
"SamplePer3Secs": -1
},
"Logging": {
"Level": "Information",
"FilePath": "logs\\SkyWalking-{Date}.log"
},
"Transport": {
"Interval": 3000,
"PendingSegmentLimit": 30000,
"PendingSegmentTimeout": 1000,
"gRPC": {
"Servers": "localhost:11800",
"Timeout": 2000,
"ConnectTimeout": 10000
}
}
}
}
\ No newline at end of file
......@@ -42,6 +42,13 @@ namespace SkyWalking.AspNet
{
var httpApplication = sender as HttpApplication;
var httpContext = httpApplication.Context;
if(httpContext.Request.HttpMethod == "OPTIONS")
{
//asp.net Exclude OPTIONS request
return;
}
var carrier = _contextCarrierFactory.Create();
foreach (var item in carrier.Items)
item.HeadValue = httpContext.Request.Headers[item.HeadKey];
......@@ -60,15 +67,21 @@ namespace SkyWalking.AspNet
public void ApplicationOnEndRequest(object sender, EventArgs e)
{
var httpApplication = sender as HttpApplication;
var httpContext = httpApplication.Context;
if (httpContext.Request.HttpMethod == "OPTIONS")
{
//asp.net Exclude OPTIONS request
return;
}
var httpRequestSpan = ContextManager.ActiveSpan;
if (httpRequestSpan == null)
{
return;
}
var httpApplication = sender as HttpApplication;
var httpContext = httpApplication.Context;
var statusCode = httpContext.Response.StatusCode;
if (statusCode >= 400)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment