注册 | 登录 - Hosting WebAPI as application inside WebForms in IIS gives 500 error

itPublisher 分享于



推荐:Inside IIS & ASP.NET

URL: January 13, 2004 Get the code here! Introduction Tools like ASP.NET greatly si

I have a Webforms application which is hosted in IIS on my local machine. This works fine and there are no issues with this site itself. I have now created a WebAPI that I want to sit on the same domain as a ‘folder’ within the web forms application, so I have added a new application within the WebForms site in IIS and pointed it to this WebAPI. The API, in standalone mode (i.e. running direct from VS) works fine, but when I try to access it via the Webforms site (e.g. I get a generic 500 Internal server error response and absolutely no detail. If I hit the API directly within IIS (as a separate site) it also works fine so its only when accessing it as an IIS application.

I've tried using a new app pool for the WebAPI application and re-using an existing one but it makes no difference.

I’ve read lots of SO questions about the same issue (i.e. 500 error returned from WebAPI) but nothing has helped. I’ve followed this ( guide too and implemented a global exception filter, put a breakpoint on that and again nothing gets hit. Also, the global error handler in the parent webforms site never fires either so I dont think that is somehow erroring...

I’m not 100% sure if it’s the parent Webforms site, the WebAPI or my IIS config that’s at fault here. The WebForms and WebAPI are both 4.0 sites in IIS if that is relevant.

Edit: I have turned on Failed Request tracing and the only relevant part I can see is:


1.5.2 在IIS上配置ASP.NET 在服务器上部署ASP.NET网站时,需要.NET的运行环境.NET Framework。.NET Framework类似于Java的JDK,包含有.NET程序运行环境和命令行





Internal Server Error 


The operation completed successfully.


Nothing else in the failed request trace seems to have any hint of a problem/error!?!

Any hints/suggestions much appreciated. iis webforms
  this question
edited Sep 18 '14 at 13:43 asked Sep 18 '14 at 8:51 LDJ 2,114 5 22 48 1   If you look in the Event Log on the server, do you see any exceptions related to your Web API site? –  mason Sep 18 '14 at 13:45      Hi Mason. Thanks for this. DOH. Didn't think to check there! Led me to the problem though and it was the http handlers and modules in the parent config file interfering with the child application. –  LDJ Sep 18 '14 at 14:24


Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

推荐:Hosting ASP.NET Outside of IIS

Hosting ASP.NET Outside of IIS One of the things that bugs me abou








您的注册邮箱: 修改

重新发送激活邮件 进入我的邮箱