WebApi 的 {"message":"an error has occurred"} 在 IIS7 上,不在 IIS Express 上 [英] WebApi's {"message":"an error has occurred"} on IIS7, not in IIS Express

查看:29
本文介绍了WebApi 的 {"message":"an error has occurred"} 在 IIS7 上,不在 IIS Express 上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 ASP.NET MVC 4 WebApi,并且在我的本地计算机上的 IIS Express 上运行它很有趣.我也将 IIS Express 配置为为远程计算机提供服务,因此我公司中的其他人将我的计算机用作我们的网络服务器.

I'm working with ASP.NET MVC 4 WebApi and am having a lot of fun with it running it on my local computer on IIS Express. I've configured IIS Express to serve remote machines too, and so other's in my company are using my computer as our webserver.

在确定这是一个不太理想的解决方案后,我们决定在安装 .NET 4.5 后将 WebApi 放在远程服务器上.当我使用 fiddler 并将 POST 发送到本地计算机上的控制器时,它会返回正确的响应,但是当我将域更改为运行 IIS7 的网络服务器时,相同的 POST 返回一个神秘的

After deciding this was a less-than-optimal solution, we decided to put the WebApi on a remote server after installing .NET 4.5. When I use fiddler and sent a POST to a controller on my local machine it returns the correct response, yet when I change the domain to the webserver running IIS7 the same POST returns a cryptic

{"message":"发生错误"}

{"message":"an error has occurred"}

消息.有人知道会发生什么吗?

message. Anyone have any idea what could be going on?

推荐答案

问题是缺少一个不在服务器上但在我的本地计算机上的依赖项.在我们的例子中,它是一个 Devart.Data.Linq dll.

The problem was a missing dependency that wasn't on the server but was on my local machine. In our case, it was a Devart.Data.Linq dll.

为了得到这个答案,我为 500 错误打开了 IIS 跟踪.这提供了一些信息,但真正有用的是在 web.config 中设置 <system.web><customErrors mode="Off"/></system.web> 这表明缺少动态加载的依赖项.添加这个依赖并告诉它在本地复制后,服务器开始工作.

To get to that answer, I turned on IIS tracing for 500 errors. That gave a little bit of information, but the really helpful thing was in the web.config setting the <system.web><customErrors mode="Off"/></system.web> This pointed to a missing dynamically-loaded dependency. After adding this dependency and telling it to be copied locally, the server started working.

这篇关于WebApi 的 {"message":"an error has occurred"} 在 IIS7 上,不在 IIS Express 上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆