Skip to content

Commit

Permalink
Merge pull request #1035 from akshaybheda/fix/500ErrorNoise
Browse files Browse the repository at this point in the history
the com exceptions are just bad requests which should not be 500
  • Loading branch information
andersjonsson authored Mar 7, 2024
2 parents 4855660 + 29f5311 commit 5496567
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/SoapCore/SoapCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<Description>SOAP protocol middleware for ASP.NET Core</Description>
<Version>1.1.0.46</Version>
<Version>1.1.0.47</Version>
<Authors>Digital Design</Authors>
<TargetFrameworks>netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
<PackageId>SoapCore</PackageId>
Expand Down Expand Up @@ -35,20 +35,24 @@
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="2.1.1" />
<PackageReference Include="System.IO.Pipelines" Version="4.7.0" />
<PackageReference Include="System.CodeDom" Version="4.7.0" />
<PackageReference Include="Microsoft.AspNetCore.Connections.Abstractions" Version="2.1.3" />
</ItemGroup>

<ItemGroup Condition="$(TargetFramework) == 'netcoreapp3.1'">
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="System.CodeDom" Version="4.7.0" />
<PackageReference Include="Microsoft.AspNetCore.Connections.Abstractions" Version="3.1.32" />
</ItemGroup>

<ItemGroup Condition="$(TargetFramework) == 'net5.0'">
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="System.CodeDom" Version="5.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Connections.Abstractions" Version="5.0.17" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework) == 'net6.0'">
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="System.CodeDom" Version="6.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Connections.Abstractions" Version="6.0.27" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 6 additions & 0 deletions src/SoapCore/SoapEndpointMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
using System.Net.Http.Headers;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security.Authentication;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using Microsoft.AspNetCore.Connections;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.Mvc;
Expand Down Expand Up @@ -324,6 +326,10 @@ private async Task ProcessOperation(HttpContext httpContext, IServiceProvider se
{
status = StatusCodes.Status400BadRequest;
}
else if (ex is ConnectionResetException)
{
status = StatusCodes.Status400BadRequest;
}

responseMessage = CreateErrorResponseMessage(ex, status, serviceProvider, requestMessage, messageEncoder, httpContext);
}
Expand Down

0 comments on commit 5496567

Please sign in to comment.