简体   繁体   中英

ASP.NET Rest Service returning 500 errors on return when hosted in IIS 7.5, but works in VS Debug Server

I'm having an issue where a service hosted in IIS 7.5 is returning 500 errors after the return value in the function. I attached the debugger to the IIS process, and can step through the methods with success, however, even on a method that simply returns a string literal, I get a 500 in the browser (and fiddler2), the debugger doesnt pick up an error at all. Nothing shows up in the Application logs either.

When I debug the site/service in visual studio - the service works just fine, returning values as expected. What could I be missing?

Its always after asking for help I seem to find an answer....

Turns out having

<httpProtocol>
  <customHeaders>
    <add name="Access-Control-Allow-Origin" value="*" />
    <add name="Access-Control-Allow-Headers" value="Content-Type" />
  </customHeaders>
</httpProtocol>

in in the main web.config, and within the web.config in the service's folder will cause this behavior. Amazing it works in IIS Express, however.

The service executes just fine, but there is a 500 error AFTER the return.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM