ITKeyword,专注技术干货聚合推荐

注册 | 登录

asp.net - Hosting WebAPI as application inside WebForms in IIS gives 500 error

itPublisher 分享于

2020腾讯云双十一活动,全年最低!!!(领取3500元代金券),
地址https://cloud.tencent.com/act/cps/redirect?redirect=1073

【阿里云】双十一活动,全年抄底价,限时3天!(老用户也有),
入口地址https://www.aliyun.com/1111/home

推荐:Inside IIS & ASP.NET

URL:http://www.theserverside.net/tt/articles/showarticle.tssid=IIS_ASP 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. www.webformssite.com/iis-applciation-name/api/test) 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 (http://www.asp.net/web-api/overview/testing-and-debugging/exception-handling) 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 asp.net 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:

推荐:ASP.NET的IIS配置

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

    -MODULE_SET_RESPONSE_ERROR_STATUS 


ModuleName
AspNetInitializationExceptionModule 

Notification
BEGIN_REQUEST 

HttpStatus
500 

HttpReason
Internal Server Error 

HttpSubStatus
0 

ErrorCode
The operation completed successfully.
 (0x0) 

ConfigExceptionInfo

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

Any hints/suggestions much appreciated.

asp.net iis asp.net-web-api 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 http://hyperthink.net/blog/permalink.aspxguid=271632d2-07e3-41af-9e58-9a7e25348b8c One of the things that bugs me abou


相关阅读排行


相关内容推荐

最新文章

×

×

请激活账号

为了能正常使用评论、编辑功能及以后陆续为用户提供的其他产品,请激活账号。

您的注册邮箱: 修改

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

如果您没有收到激活邮件,请注意检查垃圾箱。