ASP.NET MVC应用程序中的robots.txt返回404

时间:2022-08-28 04:03:38

I've deployed an ASP.NET MVC site with a robots.txt file in the root but when I try and access this url it's returning 404. I have an .xml and a .html file in the root as well and they return valid content.

我在根目录中部署了一个带有robots.txt文件的ASP.NET MVC站点,但是当我尝试访问此URL时,它返回404.我在根目录中也有.xml和.html文件,它们返回有效内容。

I'm running this on IIS 6. I've tried adding .txt as "text/plain" to the MIME Types but no luck.

我在IIS 6上运行它。我尝试将.txt作为“text / plain”添加到MIME类型但没有运气。

Suggestions?

2 个解决方案

#1


Did you look the extension mapping inside IIS? File extension can be associated with handlers and it might be possible that it's mapped to ASP.NET dll. Make sure that robots.txt is also located at the root of your website.

您是否在IIS中查看扩展映射?文件扩展名可以与处理程序相关联,它可能会映射到ASP.NET dll。确保robots.txt也位于您网站的根目录下。

#2


Check your web.config. It could be blocking access to it, in the same way the web.config in the /Views folder blocks direct access to all the View Pages.

检查你的web.config。它可以阻止对它的访问,就像/ Views文件夹中的web.config阻止直接访问所有View页面一样。

#1


Did you look the extension mapping inside IIS? File extension can be associated with handlers and it might be possible that it's mapped to ASP.NET dll. Make sure that robots.txt is also located at the root of your website.

您是否在IIS中查看扩展映射?文件扩展名可以与处理程序相关联,它可能会映射到ASP.NET dll。确保robots.txt也位于您网站的根目录下。

#2


Check your web.config. It could be blocking access to it, in the same way the web.config in the /Views folder blocks direct access to all the View Pages.

检查你的web.config。它可以阻止对它的访问,就像/ Views文件夹中的web.config阻止直接访问所有View页面一样。