我已经将一个Web服务部署到运行lighttpd和fastcgi-mono-server2的ubuntu服务器上。 .asmx页面正确加载,但是当我测试方法时,我得到了404。
我的Web服务名为Import.asmx,我的方法称为下载,404回来说import.asmx / download不存在
使用xsp2,相同的服务可以正常运行
我认为这与lighttpd / fastcgi如何为/ download提供服务有关,但无法解决如何修复它。
答案 0 :(得分:0)
解决了404错误......但现在我有了500。
实际上我在每个MyService.asmx / SomeMethod帖子调用时都收到此错误。解决方案[不是真的]我已经弄清楚了:
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 更改为 asmx /()*。确定没有404但现在是500:System.Web.HttpException:访问文件'/Services/MyService.asmx/MyMethod'时不允许使用方法'POST'。
这个发现给了我一些线索,nginx没有正确处理这种请求。谷歌搜索了近2个小时后,我找到了solution:
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;
}
我离它不远。只需在当前的位置规则之前添加此位置规则并正常工作。
答案 1 :(得分:0)
我遇到了同样的问题。当没有找到资产时,原来是服务404的默认指令。删除了以下行:
try_files $uri $uri/ =404;
在/ etc / nginx / fastcgi_params中添加PATH_INFO
作为fastcgi param:
fastcgi_param PATH_INFO $fastcgi_path_info;
为我修好了。希望它有所帮助。