2015-11-03 88 views
2

正如标题所示,我在我的MVC Web应用程序中遇到了“访问路径”错误。站点应用程序池是具有身份网络服务的DefaultAppPool。我已经完全控制网络服务用户,没有运气,然后我试图给每个人完全控制,但它仍然无法正常工作。我正在运行来自同一文件夹(C:\ Users \ YYY \ Documents \ Visual Studio 2015 \ Projects)的另一个应用程序,它的工作原理没有问题。访问路径“全局 {xxx} _YYY-YYY:13552”被拒绝。迟发型?

失败的文件包含启动Hangfire的方法。这可能与它有关吗?

我使用IIS 10.0运行Windows 10 Pro。

public void Start() 
{ 
    lock (_lockObject) 
    { 
     if (_started) return; 
     _started = true; 

     HostingEnvironment.RegisterObject(this); 

     GlobalConfiguration.Configuration 
      .UseSqlServerStorage("connection string"); 
      // Specify other options here 
     _backgroundJobServer = new BackgroundJobServer(); 
    } 
} 

http://docs.hangfire.io/en/latest/deployment-to-production/making-aspnet-app-always-running.html

C:\Users\YYY\Documents\Visual Studio 2015\Project

Security settings

Server Error in '/' Application.

Access to the path 'Global{4deecd4f-19f6-426b-xxxx-xxxxxxxxxxxx}_YYY-YYY:13552' 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 'Global{4deecd4f-19f6-426b-xxxx-xxxxxxxxxxxx}_YYY-YYY:13552' 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 , 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 File 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.

Source Error:

Line 36: _backgroundJobServer = new BackgroundJobServer();

回答

0

发现问题当前的权限,我有两个网站上相同的应用程序池中运行迟发型。当我为每个网站创建一个新的应用程序池时,一切都开始奏效。

在同一个应用程序池上运行的两个Hangfire实例似乎都试图通过相同的端口进行通信,因此,首先启动的应用程序是唯一可以工作的应用程序。他们开始使用同一个应用程序池的原因是纯粹的懒惰,我只在本地IIS的Visual Studio中创建了一个虚拟目录来运行该项目。

enter image description here