简体   繁体   中英

ASP.NET routes on IIS 7 keep reverting

I have deployed an ASP.NET MVC web application to an IIS 7 server. It's in the root directory of the www folder. There is a sub folder that is not part of the application that needs to be served up as normal. So I added some code into my MVC app routes.

Basically I:

  routes.IgnoreRoute(name);
  var ignore_route = string.Concat(name, @"\/(.*)");
  routes.IgnoreRoute("{*path}", new { path = ignore_route });

This words perfectly. For a while. Then it breaks. Specifically, going to "/subDirectory" (ie without the trailing slash) gives a "401 - Unauthorized: Access is denied due to invalid credentials." This wouldn't bother me except for the fact that due to business cards in the wild giving the subDirectory url without the trailing slash. It has to work.

It always works fine on my dev machine, but it's not running on IIS there.

I don't understand how it could work for a while and then break. If I copy over the assembly, it starts working again, and then it stops by the next day.

One possibility is that when I first deployed this web application, this code was not present. I had to add it later when we realized that there needed to be subdirectories that would be served up normally. So my first gut feeling was that it was somehow reverting back to an older version of the assembly. I have no idea how this would happening, though. When I access the directory via ftp, the modified dates are correct. The only access I have to the server is through ftp, but the server admins who are supposed to be helping me with this have been frustratingly absent. I'm at my wits end. Any ideas?

EDIT: I don't know why this was sent over here to stack overflow. This is obviously a server issue, isn't it? Look at the first response! It's talking about the server. The code works fine. Can we get this booted back over to serverfault where it belongs?

可能是您的服务器不时地重新启动HttpApplication,并且您正在检查布尔值以查看是否已配置它,否则它保持不变,因此您不添加路由吗?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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