.net 4.0 + IIS 7 + visual studio 2010, how to publish web application project to IIS?

Dev Environment: .Net 4.0 + IIS 7 + visual studio 2010 + win 7


经历:

1. 在visual studio 2010里create web application project: select menu "File > New > Project...", select "Visual c# > Web > ASP.NET Web Application"

2. run it in debug mode, it works fine with a random port. 应该是visual studio里有一个内置的iis server.

3. 现在想把该web app放到production IIS上。我天真地以为把整个project folder copy到wwwroot目录下就OK了,但其实不行。需要在IIS Manager里创建一个application, 然后再把project里的东东复制到该application指向的physical path里。具体做法是:

step 1. Open IIS Manager. click start button, and then right click "Computer", select "Manage". And access "Services and Applications > IIS" node

step 2 right click web site node (e.g. "Default Web site"), select "Add Application...". (注意:若选"Add Virtual Directory"是不行的!)

step 3 input"Alias", select ASP.NET 4.0 as Application Pool, and set "Physical Path" to 你将放置web app东东的path,click OK. 

     注意:如果把Physical Path直接指向visual studio project folder path,则可能会出现下列错误。这应该是由于project folder permission导致的。具体参看http://support.microsoft.com/kb/942055

Server Error in Application "application name"
HTTP Error 500.19 – Internal Server Error 
HRESULT: 0x80070005
Description of HRESULT
The requested page cannot be accessed because the related configuration data for the page is invalid.


step 4 把web app的所有东东复制到step 3设置的"Physical Path" 里即可。


另外还有一个办法是直接在visual studio里直接publish web app to IIS,参看下面文章的Approach 2

http://www.shubho.net/2011/01/quick-deployment-of-aspnet-applications.html


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值