接收“路径”选项“是被禁止的。” ASP.NET网站异常
由于我们将网站移至新的服务器设置,我收到错误 System.Web.HttpException:禁止路径“OPTIONS”。
。我无法重新创建该错误,但我每天至少会收到几次有关此异常的电子邮件。有什么想法可能导致此问题以及如何解决它?
编辑: 堆栈跟踪:
at System.Web.HttpMethodNotAllowedHandler.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
没有名为 OPTIONS 的目录或文件,我相信所有权限都是正确的。我正在找到一些有关 EXCEL 从网络服务器获取数据的可能链接的信息,但还没有任何内容可以完整解释如何或发生了什么。
再次编辑: 似乎这与在 Internet Explorer 中打开 Excel 文件有关。
I am getting the error System.Web.HttpException: Path 'OPTIONS' is forbidden.
since we moved our website over to a new server setup. I am unable to recreate the error but I am receiving emails for this exception at least a few times a day. Any ideas what could be causing this and how I can fix it?
EDIT:
Stack Trace:
at System.Web.HttpMethodNotAllowedHandler.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
There are no directories or files named OPTIONS and I believe all permissions are correct. I am finding some information about a possible link to EXCEL getting data from the webserver, but nothing that full explains how or what is happening yet.
EDIT AGAIN:
Seems this has to do with Excel files opening in Internet Explorer..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
OPTION 是“Microsoft 数据访问 Internet 发布提供商协议发现”(MS Office 的一部分)使用的动词,用于在用户从 Office 应用程序内部打开 URL 时发出请求。
您应该能够通过在 Word/Excel 2003 及更高版本中转至“文件”>“打开”并指定文件的完整 URL 来重新创建问题。或者,也可以在 Office 文档中放置指向服务器上 Excel 文件的链接并单击它。
您可以通过将其添加到 web.config 文件中来修复此问题,并为每种文件类型添加附加行:
OPTION is a verb used by "Microsoft Data Access Internet Publishing Provider Protocol Discovery" (Part of MS Office) to make request when a user opens a URL from inside office applications.
You should be able to re-create the issue by going File>Open in Word/Excel 2003 and above and specifying the full URL of the file. Alternatively by placing a link to an excel file on your server in an office document and clicking it.
You can fix it by adding this to your web.config file with additional lines for each file type:
您是否收到任何用户错误报告或类似报告。 OPTIONS 是一个 http 动词,用于查找服务器的功能。听起来您的新 Web 服务器未配置为允许使用此动词,可能是出于安全原因。来自浏览器的正常 Web 请求不会使用此动词,恶意软件/机器人经常使用它来扫描 Web 服务器以查找可利用的漏洞。
Are you getting any user error reports or similar. OPTIONS is an http verb that is used to find outthe capabilities of the server. It sounds like your new web server is not configured to allow this verb, probably for security reasons. A normal web request from a browser would not use this verb and it is often used by malware/bots scanning web servers for vulnerabilities to exploit.
当我在尝试从 ASP.Net 网页发送 .xls 文件时遇到此确切错误时,这是因为我在这里省略了文件扩展名:
fileName
需要为fileName.xls
When I got this exact error while trying to send an .xls file from an ASP.Net web page, it was because I had omitted the filename extension here:
That
fileName
needs to befileName.xls
当您尝试从本地主机打开 .xls 时,会出现此错误。对于 IIS,它不会引发任何错误。
您可以
在 web.config 中使用。
This error occurs when you try to open .xls from localhost. In case of IIS, it doesn't throw any error.
You can use
in web.config.
这似乎对我来说效果很好:
This seems to be working well for me:
这可能是您系统上的权限。为了获得更多细节,谷歌搜索的搜索词是“路径被禁止”——选项部分是一个特定于您的应用程序的字符串。
更好的是,绞尽脑汁,尝试想一下应用程序中尝试访问具有该名称的 URL 或文件路径的部分。
This is probably permissions on your system. To get a little more detail, the search term to google up is "Path is forbidden" -- the OPTIONS part is a string that is specific to your application.
Better yet, rack your brain a little and try to think of a part of your application that attempts to access a URL or file path with that name.