I ran into an issue with signalR's js client in which when using the token factory, the token is sent in the query string. When our .net 8 application was deployed to azure, if the token exceeded ~2100 characters, we would get a 404 during initial connection. After some research, I found the likely culprit was iis's request filtering module. I found adding
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxQueryString="5000"></requestLimits>
</requestFiltering>
</security>
</system.webServer>
</configuration>
I feel quite silly as I have not had to change any of the webserver limits since working with aspnetcore. Our project does not have a web.config at the moment; however, when published the generated one contains
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\Web.Api.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
</system.webServer>
</location>
</configuration>
Editing this in a test environment to have
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\Web.Api.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
<security>
<requestFiltering>
<requestLimits maxQueryString="5000"></requestLimits>
</requestFiltering>
</security>
</system.webServer>
</location>
</configuration>
resolved the issue.
What is the correct way to resolve this? A web config in the project with
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\Web.Api.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
<security>
<requestFiltering>
<requestLimits maxQueryString="5000"></requestLimits>
</requestFiltering>
</security>
</system.webServer>
</location>
</configuration>
or just
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxQueryString="5000"></requestLimits>
</requestFiltering>
</security>
</system.webServer>
</configuration>
Thanks!