2011-07-03 115 views
3

我正在將MVC3應用程序部署到新服務器。該應用程序運行在開發服務器(Visual Studio中),並在IIS7我的開發機器上很好,但在服務器上我得到一個403錯誤:ASP.NET MVC 3部署403 Windows Server 2008 R2上的錯誤

enter image description here

我已經完成了下面的步驟,但現在出於想法。請幫忙!

  • 使用我自己的計算機上使用相同的Xcopy部署的技術,我已經部署文件到服務器,並增加了以下文件夾的權限:

IUSR - 閱讀&執行,列出文件夾目錄,讀取 IIS_IUSRS - 閱讀&執行,列出文件夾目錄,讀取

  • 我也安裝ASP.NET MVC3的服務器,以便ADDI需要.dll在GAC中

  • IIS已建立,並且我可以訪問基本的html文件(例如我在站點路由中放入的test.html)。

  • 我已經在服務器管理器檢查所有角色服務安裝

  • 曾試圖斌從MVC複製文件的安裝位置,並把bin目錄

Ç部署:\ Program Files(x86)\ Microsoft ASP.NET \ ASP.NET MVC 3 \ Assemblies

C:\ Program Files(x86)\ Microsoft ASP.NET \ ASP.NET Web Pages \ v1.0 \ Assemblies

+0

您是否嘗試過使用Visual Studio嚮導部署新創建的應用程序? –

+0

Visual Studio沒有安裝在服務器上 – gb2d

+0

我的意思是在本地開發機器上創建這個項目,然後部署它。我想了解的是,您是否遇到配置IIS的問題,或者您的應用程序出現問題。 –

回答

7

好的,發現問題。這裏是任何其他人都有相同的問題:

我使用的服務器必須有.NET 4之前安裝的IIS。這意味着.NET 4沒有被註冊到IIS。

我在檢查IIS配置時發現了這個問題。單擊網站的.NET編譯圖標會引發異常,可能是因爲應用程序無法編譯。

這使我到指示我hanselman.com

總之堆棧溢出後,我不得不在服務器上安裝VS2010,所以我不得不在Visual Studio命令提示符下可用,然後註冊.NET 4在命令行上使用IIS。

IIS Manager can't configure .NET Compilation on .NET 4 Applications

http://www.hanselman.com/blog/ASPNET4BreakingChangesAndStuffToBeAwareOf.aspx

主要部分:

「我安裝ASP.NET 4,然後 安裝IIS。」

如果您安裝VS2010和/或。NET 4 首先,然後安裝IIS,你需要確認IIS配置爲 瞭解ASP.NET 4,否則IIS 將不知道如何運行ASP.NET 4 應用程序。

There's a simple workaround

If you are already in this state, drop to the command line and navigate to the FX install directory. Then run "aspnet_regiis –iru".

Note if you are on a 64-bit machine, run this command from the 64-bit FX install directory – not the 32-bit installation directory.

or for future reference, try to enable IIS and the ASP.NET extensibility option first when your are building machines or VMs. That way when VS 2010 or .NET are subsequently installed, the installation will automatically detect the presence of IIS and will auto-register with it.

相關問題