.axd文件生成404错误

时间:2021-04-08 09:46:04

Why do all of my .axd files generate a 404 error when on our production server?

为什么我所有的.axd文件在生产服务器上都会产生404错误?

9 个解决方案

#1


6  

You need to create a MIME type for that extension in IIS:

您需要在IIS中为该扩展创建一个MIME类型:

To define a MIME type for a specific extension, follow these steps:

要为特定的扩展定义MIME类型,请遵循以下步骤:

  1. Open the IIS Microsoft Management Console (MMC), right-click the local computer name, and then click Properties.
  2. 打开IIS Microsoft管理控制台(MMC),右键单击本地计算机名称,然后单击属性。
  3. Click HTTP Headers.
  4. 单击HTTP头。
  5. Click MIME Types.
  6. 单击MIME类型。
  7. Click New.
  8. 单击New。
  9. In the Extension box, type the file name extension that you want (for example, .axed)
  10. 在扩展框中,键入所需的文件名扩展名(例如.axed)
  11. In the MIME Type box, type application/octet-stream.
  12. 在MIME类型框中,键入application/octet-stream。
  13. Apply the new settings. Note that you must restart the World Wide Web Publishing Service or wait for the worker process to recycle for the changes to take effect. In this example, IIS now serves files with the .axed extension.
  14. 应用新的设置。请注意,您必须重新启动万维网发布服务,或等待工作流程对更改生效。在本例中,IIS现在使用.axed扩展名来处理文件。

#2


15  

if you're on IIS7 make sure you add the handler to the <system.webServer><handlers> section:

如果您在IIS7上,请确保将处理程序添加到 <处理程序> 部分: 。网络服务器>

<add name="MyName" path="MyName.axd" verb="*" type="NameSpace.Class, Assembly" />

#3


7  

In my case, I was transferring project from .NET 2.0 using automatic conversion. Converter added the <system.webServer> section and all the handlers and modules that are in the <system.web>. However, for each handler it added the following attribute: preCondition="integratedMode,runtimeVersionv2.0" Once I removed the attribute the 404s stopped and handler started to work.

在我的例子中,我使用自动转换从。net 2.0传输项目。转换器添加 <系统。webserver> 节以及 中的所有处理程序和模块。但是,对于每个处理程序,它都添加了以下属性:preCondition=“integratedMode,runtimeVersionv2.0”。

#4


4  

Confirm that in Request Filtering you either * have .axd as an Allowed extension, or * have Allow unlisted file name extensions ticked in Edit Request Filtering Settings

确认在请求过滤中,您要么*有.axd作为允许的扩展名,要么*允许在编辑请求过滤设置中勾选未列出的文件名扩展名

The same effect can be achieved with the following web.config section:

下面的web也可以达到同样的效果。配置部分:

<system.webServer>
    <security>
        <requestFiltering>
            <fileExtensions>
                <add fileExtension=".axd" allowed="true" />
            </fileExtensions>
        </requestFiltering>
    </security>
</system.webServer>

#5


3  

You can check the following:

你可以查看以下内容:

  1. Check in the IIS management console that the .axd extension (the default HTTP handler extension) is allowed.
  2. 请检查IIS管理控制台,允许.axd扩展(默认的HTTP处理程序扩展)。
  3. Also check if the “Verify if file exists” checkbox is unchecked. This screen appears after you click the "Edit" button after selecting the axd extension.
  4. 还检查“验证文件是否存在”复选框是否未选中。在选择axd扩展名后,单击“编辑”按钮后将出现此屏幕。
  5. Check if the HTTP handler is correctly registered in web.config. It should also be in the right config section depending on the IIS version. For IIS6 and IIS7 Classic mode it should be in <system.web><httpHandlers>. For IIS7 Integrated mode it should be registered in <system.webServer><handlers>.
  6. 检查HTTP处理程序是否在web.config中正确注册。根据IIS版本,它也应该位于正确的配置部分。对于IIS6和IIS7经典模式,它应该位于 。对于IIS7集成模式,它应该在 中注册。

#6


2  

We had error 500(it is not 404, but who knows) on our production server some time ago. No script resources were able to load.

不久前,我们的生产服务器上出现了错误500(不是404,但谁知道呢)。没有脚本资源可以加载。

The problem was in the time difference between our development and production servers. It was -7 hours. .NET threw an exception because of it tried to use a "time in the future" of an assembly with embedded script resources.

问题在于开发服务器和生产服务器之间的时间差异。. net抛出了一个异常,因为它试图使用具有嵌入式脚本资源的程序集的“未来时间”。

Decreasing {website}/bin/ folder (actually assemblies' in it) creation date by day solved the problem.

每天减少{网站}/bin/文件夹(实际上是程序集)的创建日期解决了这个问题。

#7


0  

Can you make a "bad" request that fails and then check the server's system and application event logs?

是否可以发出一个失败的“坏”请求,然后检查服务器的系统和应用程序事件日志?

There are several issues around axd that can cause 404s or 500s (such as the "time in the future" issue mentioned by Alex), but they leave a footprint in the event log.

axd有几个问题可能导致404s或500s(比如Alex提到的“未来的时间”问题),但它们会在事件日志中留下足迹。

Have a look and post any log entries that mention axds.

查看并发布任何提到axds的日志条目。

#8


0  

I added a attribute runAllManagedModulesForAllRequests="true" into modules.. node of the system.webServer section, the 404s stopped and handler started to work.

我将一个属性runallmanagedmodulesforallrequest ="true"添加到模块中。系统的节点。webServer部分,404s停止,处理器开始工作。

#9


0  

If this will help anyone, I had the same problem, few of us spent 2 days on. On 3 servers everything worked ok and allso on development but on this server 404 non stop. The solution, I changed poold from integrated to classic and that worked

如果这对任何人都有帮助,我也有同样的问题,我们很少有人花两天时间。在3台服务器上,所有的东西都可以正常工作,所有的东西都可以开发,但是在这个服务器上,404不能停止。解决方案是,我把poold从集成变成了经典

#1


6  

You need to create a MIME type for that extension in IIS:

您需要在IIS中为该扩展创建一个MIME类型:

To define a MIME type for a specific extension, follow these steps:

要为特定的扩展定义MIME类型,请遵循以下步骤:

  1. Open the IIS Microsoft Management Console (MMC), right-click the local computer name, and then click Properties.
  2. 打开IIS Microsoft管理控制台(MMC),右键单击本地计算机名称,然后单击属性。
  3. Click HTTP Headers.
  4. 单击HTTP头。
  5. Click MIME Types.
  6. 单击MIME类型。
  7. Click New.
  8. 单击New。
  9. In the Extension box, type the file name extension that you want (for example, .axed)
  10. 在扩展框中,键入所需的文件名扩展名(例如.axed)
  11. In the MIME Type box, type application/octet-stream.
  12. 在MIME类型框中,键入application/octet-stream。
  13. Apply the new settings. Note that you must restart the World Wide Web Publishing Service or wait for the worker process to recycle for the changes to take effect. In this example, IIS now serves files with the .axed extension.
  14. 应用新的设置。请注意,您必须重新启动万维网发布服务,或等待工作流程对更改生效。在本例中,IIS现在使用.axed扩展名来处理文件。

#2


15  

if you're on IIS7 make sure you add the handler to the <system.webServer><handlers> section:

如果您在IIS7上,请确保将处理程序添加到 <处理程序> 部分: 。网络服务器>

<add name="MyName" path="MyName.axd" verb="*" type="NameSpace.Class, Assembly" />

#3


7  

In my case, I was transferring project from .NET 2.0 using automatic conversion. Converter added the <system.webServer> section and all the handlers and modules that are in the <system.web>. However, for each handler it added the following attribute: preCondition="integratedMode,runtimeVersionv2.0" Once I removed the attribute the 404s stopped and handler started to work.

在我的例子中,我使用自动转换从。net 2.0传输项目。转换器添加 <系统。webserver> 节以及 中的所有处理程序和模块。但是,对于每个处理程序,它都添加了以下属性:preCondition=“integratedMode,runtimeVersionv2.0”。

#4


4  

Confirm that in Request Filtering you either * have .axd as an Allowed extension, or * have Allow unlisted file name extensions ticked in Edit Request Filtering Settings

确认在请求过滤中,您要么*有.axd作为允许的扩展名,要么*允许在编辑请求过滤设置中勾选未列出的文件名扩展名

The same effect can be achieved with the following web.config section:

下面的web也可以达到同样的效果。配置部分:

<system.webServer>
    <security>
        <requestFiltering>
            <fileExtensions>
                <add fileExtension=".axd" allowed="true" />
            </fileExtensions>
        </requestFiltering>
    </security>
</system.webServer>

#5


3  

You can check the following:

你可以查看以下内容:

  1. Check in the IIS management console that the .axd extension (the default HTTP handler extension) is allowed.
  2. 请检查IIS管理控制台,允许.axd扩展(默认的HTTP处理程序扩展)。
  3. Also check if the “Verify if file exists” checkbox is unchecked. This screen appears after you click the "Edit" button after selecting the axd extension.
  4. 还检查“验证文件是否存在”复选框是否未选中。在选择axd扩展名后,单击“编辑”按钮后将出现此屏幕。
  5. Check if the HTTP handler is correctly registered in web.config. It should also be in the right config section depending on the IIS version. For IIS6 and IIS7 Classic mode it should be in <system.web><httpHandlers>. For IIS7 Integrated mode it should be registered in <system.webServer><handlers>.
  6. 检查HTTP处理程序是否在web.config中正确注册。根据IIS版本,它也应该位于正确的配置部分。对于IIS6和IIS7经典模式,它应该位于 。对于IIS7集成模式,它应该在 中注册。

#6


2  

We had error 500(it is not 404, but who knows) on our production server some time ago. No script resources were able to load.

不久前,我们的生产服务器上出现了错误500(不是404,但谁知道呢)。没有脚本资源可以加载。

The problem was in the time difference between our development and production servers. It was -7 hours. .NET threw an exception because of it tried to use a "time in the future" of an assembly with embedded script resources.

问题在于开发服务器和生产服务器之间的时间差异。. net抛出了一个异常,因为它试图使用具有嵌入式脚本资源的程序集的“未来时间”。

Decreasing {website}/bin/ folder (actually assemblies' in it) creation date by day solved the problem.

每天减少{网站}/bin/文件夹(实际上是程序集)的创建日期解决了这个问题。

#7


0  

Can you make a "bad" request that fails and then check the server's system and application event logs?

是否可以发出一个失败的“坏”请求,然后检查服务器的系统和应用程序事件日志?

There are several issues around axd that can cause 404s or 500s (such as the "time in the future" issue mentioned by Alex), but they leave a footprint in the event log.

axd有几个问题可能导致404s或500s(比如Alex提到的“未来的时间”问题),但它们会在事件日志中留下足迹。

Have a look and post any log entries that mention axds.

查看并发布任何提到axds的日志条目。

#8


0  

I added a attribute runAllManagedModulesForAllRequests="true" into modules.. node of the system.webServer section, the 404s stopped and handler started to work.

我将一个属性runallmanagedmodulesforallrequest ="true"添加到模块中。系统的节点。webServer部分,404s停止,处理器开始工作。

#9


0  

If this will help anyone, I had the same problem, few of us spent 2 days on. On 3 servers everything worked ok and allso on development but on this server 404 non stop. The solution, I changed poold from integrated to classic and that worked

如果这对任何人都有帮助,我也有同样的问题,我们很少有人花两天时间。在3台服务器上,所有的东西都可以正常工作,所有的东西都可以开发,但是在这个服务器上,404不能停止。解决方案是,我把poold从集成变成了经典