I have a WebApi controller with a method that looks like such:
[HttpGet]
[AcceptVerbs(\"GET\")]
public HttpResponseMessage Run(string reportName, int someId,
This is because IIS is trying to map special characters. Adding the following to the web.config should fix the issue:
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
More information here: http://www.iis.net/configreference/system.webserver/modules
Adding the following to the web.config should not fix the complete issue:
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
The solution no longer works as an extra path segment is used in the uri for me.
https://localhost:xxxx/user@domain.com
does work
https://localhost:xxxx/path/user@domain.com
does not work
I google around and around and i understood that it is an extension. (.cs gives a different error as .com) and finaly find this: ASP.net MVC4 WebApi route with file-name in it
My solution was to add or change the following handler in the <handlers>
section of your <system.webServer>
:
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<add name="ExtensionlessUrlHandler-Integrated-4.0"
path="*.*"
verb="*"
type="System.Web.Handlers.TransferRequestHandler"
preCondition="integratedMode,runtimeVersionv4.0" />
or change the path to path=*@*.*
You need a basic URL query.
[Route("api/emails")]
public HttpResponseMessage Run(string email) {...}
GET api/emails?email=user@domain.com
Just a quick thought... could the ".com" be causing the issue?