当前位置: 代码迷 >> 综合 >> 在Windows 2008 R2 IIS 7.5 下发布 MVC 2 应用程序
  详细解决方案

在Windows 2008 R2 IIS 7.5 下发布 MVC 2 应用程序

热度:58   发布时间:2023-12-12 01:52:16.0

首先说明程序和环境:

应用程序 : VS 2008 + MVC 2.0

发布环境 : Widnows 2008 R2 Server + IIS 7.5

问题说明  :  该mvc应用程序在 xp/server 2003 + IIS 6 下面工作正常,但是当发布到 IIS 7.5 环境时,出现如下错误

(An internal error occurred.)
(System.Security.Cryptography.CryptographicException: An internal error occurred.

   at System.Security.Cryptography.CryptographicException.ThrowCryptogaphicException(Int32 hr)
   at System.Security.Cryptography.X509Certificates.X509Utils._LoadCertFromBlob(Byte[] rawData, IntPtr password, UInt32 dwFlags, Boolean persistKeySet, SafeCertContextHandle& pCertCtx)
   at System.Security.Cryptography.X509Certificates.X509Certificate.LoadCertificateFromBlob(Byte[] rawData, Object password, X509KeyStorageFlags keyStorageFlags)
   at System.Security.Cryptography.X509Certificates.X509Certificate2..ctor(Byte[] rawData)
   ... ... ...

或者会提示出现 404.0 错误,究其原因,应该是 MVC 模块,或者账户权限的问题,现解决方法如下:


解决方法:

1. 确保安装了 .Net Framework 3.5.1 Features



2. 新建 application Pool

   新建的 application pool 名为“Test Web Site“,属性设置如下


3. 添加 MVC 应用程序

并设置 "mvcSite" 应用程序的Application Pool 为新建的 "Test Web Site".


4.  添加 mvc 2 Handler Mappings.

双击 "Handler Mappings", 然后单击右上角 "Add Wildchard Script Map ..."


5. 必要时,重启 站点 或者 Application Pool, 或者重新安装 .net framework, 如运行命令:

C:\Windows\Microsoft.NET>%windir%/Microsoft.NET/Framework/v4.0.30319/aspnet_regiis.exe -i


经过上述操作,正常情况下是可以工作的。

  相关解决方案