简体   繁体   English

启用URL重写的ASP.net/MVC文件上传

[英]ASP.net/MVC file upload with URL rewrite enabled

I came across this interesting problem with an ASP.net MVC website, there is an Action method to process uploaded files and it works fine with cassini webserver but when I tried with IIS in my hosting machine the upload fails, after spending lot of time I noticed that it is because of the URL rewite rules inside set to change the incoming URLs to lowercase and add a trailing slash at the end. 我在ASP.net MVC网站上遇到了一个有趣的问题,有一种Action方法可以处理上传的文件,并且可以在卡西尼网络服务器上正常工作,但是当我在主机上尝试使用IIS时,由于花费了很多时间,上传失败了注意,这是因为设置了URL重整规则,从而将传入的URL更改为小写并在末尾添加了斜杠。

Is there any recommendations to avoid problems like this? 有什么建议可以避免这样的问题?

This might sound simple but it would work. 这听起来很简单,但可以正常工作。 Generate your routes so they match your production environment rules. 生成路线,使其与您的生产环境规则相匹配。 By doing so you'll keep the server from redirecting and causing your issue. 这样做可以防止服务器重定向并导致问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM