我已将 Web 服务部署到运行 lighttpd 和 fastcgi-mono-server2 的 ubuntu 服务器。 .asmx 页面加载正确,但当我测试该方法时,我得到 404。
我的 Web 服务称为 Import.asmx,我的方法称为 download,返回 404 提示 import.asmx/download 不存在
使用 xsp2 相同的服务可以完美运行
我认为这与 lighttpd/fastcgi 如何提供 /download 有关,但无法弄清楚如何修复它。
解决了 404 错误...但现在我有 500 错误。
实际上,我在每次 MyService.asmx/SomeMethod post 调用时都会收到此错误。解决方案[不是真的]我已经找到了:
location ~ \.(aspx|asmx|ashx|asmx\/(.*)|asax|ascx|soap|rem|axd|cs|config|dll)$ {
fastcgi_pass 127.0.0.1:9001;
index index.html index.htm default.aspx Default.aspx;
fastcgi_index Default.aspx;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
我已经将其从仅更改为asmx to asmx/()*。好的,没有 404,但现在是 500:System.Web.HttpException:访问文件“/Services/MyService.asmx/MyMethod”时不允许使用方法“POST”。
这一发现给了我一些线索,表明 nginx 无法正确处理此类请求。经过近 2 个小时的谷歌搜索,我发现了一个solution http://techcrawler.riedme.de/2011/02/14/asp-net-ajax-error-405-on-nginx/:
location ~ \.asmx(.*) {
fastcgi_split_path_info ^(.+\.asmx)(.*)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include /etc/nginx/fastcgi_params;
fastcgi_index Default.aspx;
fastcgi_pass 127.0.0.1:9001;
}
我离它并不远。只需在当前位置规则之前添加此位置规则即可正常工作。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)