2016-11-23 136 views
0

我想部署一个内置于ASPnet 4.0框架应用程序中的解决方案,开发工作在WindowsSO/IIS中完成。使用mono在Centos中部署ASP.net

现在我需要部署在作为NginX Web服务器的操作系统Centos上。

我使用的是Centos-6.8,Nginx-1.10和mono-4.6.1.5。

我的nginx的配置文件是:

server { 
    listen  80 default_server; 
    listen  [::]:80 default_server; 
    server_name _; 
    root /usr/share/nginx/html; 
    #root /usr/share/nginx/html/Site;   

    location/{ 
     index index.aspx index.html index.htm index.aspx default.aspx Default.aspx Global.asax; 
     fastcgi_index Global.asax; 
     fastcgi_pass 127.0.0.1:9000; 
     include fastcgi_params; 
    } 
    ... 
} 

文件fastcgi_params我包括:

fastcgi_param PATH_INFO   ""; 
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 

启动服务单

fastcgi-mono-server4 /applications=/:/usr/share/nginx/html /socket=tcp:127.0.0.1:9000 & 

我访问http://localhost/Default.aspx进行测试,如果它显示结果。

问题是,当访问网站文件夹http://localhost/Site/,显示以下消息:

System.Web.HttpException 
This type of page is not served. 

Description: HTTP 403.The type of page you have requested is not served because it has been explicitly forbidden. The extension '.asax' may be incorrect. Please review the URL below and make sure that it is spelled correctly. 
Details: Requested URL: /Site/Global.asax 
Exception stack trace: 
    at System.Web.HttpForbiddenHandler.ProcessRequest (System.Web.HttpContext context) [0x00073] in <d3ba84a338d241e2ab5397407351c9cd>:0 
    at System.Web.HttpApplication+<Pipeline>c__Iterator1.MoveNext() [0x00dd7] in <d3ba84a338d241e2ab5397407351c9cd>:0 
    at System.Web.HttpApplication.Tick() [0x00000] in <d3ba84a338d241e2ab5397407351c9cd>:0 

nginx的用户对网站的文件夹访问权限,可能会丢失在应用程序的web.config一些依赖性, 有任何想法吗?谢谢。

+0

由于解决方案的架构,我们决定使用[DOTNET](https://dotnet.github.io/) – jorgedison

回答