0

要优化图像并自动生成 CSSprite,请使用名为Sprite Optimization and Image Preview 4的 Microsoft 包

错误

本地一切正常,但要发布我的网站,会发生以下错误:

Access to the path 'D:\Hosting\8399780\html\dev\App_Sprites\blank.gif' is denied.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.UnauthorizedAccessException: Access to the path 'D:\Hosting\8399780\html\dev\App_Sprites\blank.gif' is denied. 

ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6 and IIS 7, and the configured application pool identity on IIS 7.5) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user. 

To grant ASP.NET access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.

试图

为了解决“App_Sprites”文件夹中的问题,添加了以下 web.config:

<?xml version="1.0"?>
<configuration>
    <system.web>
      <authorization>
        <allow users="*" />
      </authorization>
    </system.web>

  <system.webServer>
    <security>
      <authorization>
        <add accessType="Allow" users="*" />
      </authorization>
    </security>
  </system.webServer>

</configuration>

我的应用程序中的任何地方都没有使用“blank.gif”图像!文件夹内App_Sprites只有一个名为hire;的子文件夹。

4

1 回答 1

1

我相信这个框架正试图将一个空白.gif 文件写入该目录。您需要授予 IIS 应用程序池在其下运行 Windows 中该文件夹的写入权限的帐户。

于 2011-11-09T11:12:19.970 回答