记一次IIS项目部署中遇到的种种问题

今天在腾讯服务器上部署公司的项目,遇到了不少的问题,简直能够用一波未平一波又起来形容。

记录一下,怕本身忘记,顺便也帮助跟我遇到一样问题的人。

项目使用VS2010.MVC3.0开发,服务器的操做系统是Windows server 2008,下面我就讲下部署的步骤。html

1.安装IISweb

打开服务器管理器->角色->添加角色->勾选Web服务器(IIS),而后一直下一步,完成安装便可,windows server 2008安装的是IIS7windows

2.使用快捷键WIN+R,即打开运行窗口,而后输入“inetmgr”,快速打开IIS安全

3.IIS左侧有个树列表,找到“网站”节点,右键新建网站,填写网站名称,绑定端口,还有项目的物理路径。这里须要说一下,在建立网站的同时,你能够在应用程池列表中选择一个来托管项目,服务器

若是不选的话会自动生成一个与你网站名称相同的应用程序池,以下图所示。session

应用程序池的.netframework版本根据你的项目而定,若是你的项目是用.netframework4.0开发的,用v2.0就会出错。app

 

当我满心欢喜的输入url,错误展示在我面前。下面是错误的内容。asp.net

 

Server Error in '/' Application.


Runtime Error

Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine. 

Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".
ide

当客户端浏览时会出现这个错误,但这其实并非真的错误,上面的意思主要是告诉咱们若是程序出错了,让咱们指定一个错误页面,即便我加了<customErrors>,依旧报错,要像发现真正的问题,仍是得打开服务器上的IIS,网站

右侧有个操做栏,浏览网站,看到了吧,点击它,立刻抛出另外一个错误,倍儿爽。

Server Error in '/' Application.


Unable to make the session state request to the session state server. Please ensure that the ASP.NET State service is started and that the client and server ports are the same.  If the server is on a remote machine, please ensure that it accepts remote requests by checking the value of HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\aspnet_state\Parameters\AllowRemoteConnection.  If the server is on the local machine, and if the before mentioned registry value does not exist or is set to 0, then the state server connection string must use either 'localhost' or '127.0.0.1' as the server name.

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.Web.HttpException: Unable to make the session state request to the session state server. Please ensure that the ASP.NET State service is started and that the client and server ports are the same.  If the server is on a remote machine, please ensure that it accepts remote requests by checking the value of HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\aspnet_state\Parameters\AllowRemoteConnection.  If the server is on the local machine, and if the before mentioned registry value does not exist or is set to 0, then the state server connection string must use either 'localhost' or '127.0.0.1' as the server name.

Source Error: 

 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

这里原理我就不说了,只说解决方案,依旧Win+R,输入"services.msc",打开windows服务列表,找到“ASP.NET 状态服务”,打开这个这个服务并设置为自动。

ok 搞定!!

继续在IIS浏览,打开之后,又你妹报错了

未能加载文件或程序集“System.Web.Helpers, Version=1.0.0.0, Culture=neutral,

未能加载文件或程序集“System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35”或它的某一

解决方案:点我去下载MVC3,下载完安装完,这个问题就解决了。

松口气,浏览继续报错。。好吧IIS你赢了

译器错误消息: CS0016: 未能写入输出文件“c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\2e9aca09\f067b5c4\App_Web_login.aspx.cdcab7d2.5bhornew.dll”--“拒绝访问。 

解决方案:这个图比较多

C盘的Window目录下找到TEMP文件夹,若没有该文件夹,则Window目录下本身建立一个TEMP文件夹。选择TEMP文件夹点击右键,而后选择属性。

解决IIS发布时CS0016未能写入输出文件错误

 

  1. 选择安全选项卡,而后再单击编辑按钮。

    解决IIS发布时CS0016未能写入输出文件错误
  2.  

    点击添加按钮,会弹出权限操做窗体。

    解决IIS发布时CS0016未能写入输出文件错误
  3.  

    添加一个IIS_IUSRS权限对象,添加完成以后点击肯定。

    解决IIS发布时CS0016未能写入输出文件错误
  4.  

    选中刚刚新建的对象,把容许中的选项中所有打勾,最后点击肯定并关闭窗体

    解决IIS发布时CS0016未能写入输出文件错误

长舒一口气,继续迎接新的报错!!

错误信息 Server Error in ‘/’ Application. Could not load type ‘System.ServiceModel.Activation.HttpModule’ from assembly ‘System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089′.

 

解决方案:这是由于没有注册asp.net4.0,WIN+R 输入"cmd",进入命令行,输入

C:/Windows/Microsoft.NET/Framework/v4.0.30319/aspnet_regiis.exe -i

回车运行,若是读者的服务器是64系统,那么须要使用命令C:/Windows/Microsoft.NET/Framework64/v4.0.30319/aspnet_regiis.exe -i 来运行注册iis。

在忐忑中,输入url,终于出现了熟悉的页面,总算能够下班回家了!!!!

相关文章
相关标签/搜索