简体   繁体   中英

Deploying an ASP MVC application to Windows 2008 server running IIS 7.5

I've been digging around trying to get some solid information about how to go about doing this. Most of the info I've found talks about Web Deploy from Visual Studio 20xx, but I'm not sure if this is the preferred method. I want to be able to "install" an MVC website/web application to staging, then after testing/defecting fixing cycle, do another build and install it on a Production environment. How is everyone going about doing this? It seems rather strange that the documentation is so loose and limited. Isn't this what all ASP.NET dev companies do? Can someone explain to me the best approach for rolling out and updating web apps to Win2008 IIS 7.5? Basically I'm looking for a nicely packaged installer.

There are multiple ways to publish a web site. The solution depends on many factors, such as whether you are publishing internally, or externally. If you are creating an install for third parties to install on their own servers, etc..

If you have direct file system (ie network share) access to your web servers, and you aren't concerned with a formal build process with separate build servers, etc.. then using the built-in Web Publishing functionality of Visual Studio is the simplest method. You just publish directly to the filesystem of your website's virtual directory. This works very well and supports most scenarios out of the box.

If, however, you are a larger organization and want more controls. Then you can install WebDeploy on the server and publish from Visual Studio using the WebDeploy agent, although WebDeploy is tricky to setup and not well documented. WebDeploy can also be used outside of Visual Studio and has a very rich feature set.

Some people use version control to deploy to their sites. They do a build, then check it into version control, then "get latest" into the servers virtual directory. This gives them the ability to easily roll back to previous versions or point in time.

Others use build and deploy tools like MSBuild, OctopusDeploy, Chuck Norris, etc...

Yet others use Continuous Integration tools, which may use some of the tools I've already mentioned. CI servers like TeamCity, CruiseControl.net, etc...

There is a wealth of information out there, and tons of ways to do this... since so much of it is personal choice and depends on your situation, we can't really definitively say "do this" or "do that".

Ok, I got web deploy working between remote host (Windows Server 2008 R2) and client running VS2013. I found a great site that has a walkthrough.

Installing and using Web Deploy on server 2012

This applies to Windows server 2012 but also worked for Win 2008.

After I walked through everything, deployment failed with an error: "Could not load file or assembly 'Microsoft.Web.Deployment, Version=9.0.0.0..."

To resolve that issue, I downloaded and installed the latest Web Deploy package on the machine running VS 2013. At the time, the latest version was 3.5:

Web Deploy 3.5

This comes with the dependency dll that's needed for the client. What's strange, is that I didn't have to do this part on my home machine running the same version of VS 2013, so I don't know why this was necessary in this particular case.

After all of this was completed, I was able to deploy my web app remotely as admin. I wouldn't advise setting up web deploy for admin on the host because of security issues, but the walkthrough that I linked above shows how to create a user account for remote connection.

Edit: I also found a great troubleshooting guide that helped me fix a problem: Web Deploy Troubleshooting

We use the built in Visual Studio web publishing for this and combine it with web.config transformations to deploy the appropriate configuration (settings, connection strings etc.) for each environment.

Once set-up it really is as simple as selecting the publishing profile you want and pressing 'Publish'.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM