简体   繁体   English

将ASP MVC应用程序部署到运行IIS 7.5的Windows 2008服务器

[英]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. 我发现的大部分信息都是从Visual Studio 20xx开始讨论Web部署的,但我不确定这是否是首选方法。 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. 我希望能够“安装”MVC网站/ Web应用程序进行分段,然后在测试/缺少修复周期后,进行另一次构建并将其安装在生产环境中。 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? 这不是所有ASP.NET开发公司都做的吗? Can someone explain to me the best approach for rolling out and updating web apps to Win2008 IIS 7.5? 有人可以向我解释推出和更新Web应用程序到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. 如果您有直接文件系统(即网络共享)访问您的Web服务器,并且您不关心具有单独构建服务器等的正式构建过程,那么使用Visual Studio的内置Web发布功能是最简单的方法。 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并使用WebDeploy代理从Visual Studio发布,尽管WebDeploy设置起来很棘手并且没有很好的文档记录。 WebDeploy can also be used outside of Visual Studio and has a very rich feature set. WebDeploy也可以在Visual Studio之外使用,并具有非常丰富的功能集。

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... 其他人使用构建和部署工具,如MSBuild,OctopusDeploy,Chuck Norris等......

Yet others use Continuous Integration tools, which may use some of the tools I've already mentioned. 还有一些人使用持续集成工具,这些工具可能会使用我已经提到过的一些工具。 CI servers like TeamCity, CruiseControl.net, etc... CIC服务器,如TeamCity,CruiseControl.net等......

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. 好的,我在远程主机(Windows Server 2008 R2)和运行VS2013的客户端之间进行了Web部署。 I found a great site that has a walkthrough. 我找到了一个很棒的网站,有一个演练。

Installing and using Web Deploy on server 2012 在server 2012上安装和使用Web Deploy

This applies to Windows server 2012 but also worked for Win 2008. 这适用于Windows Server 2012,但也适用于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..." 在我浏览完所有内容后,部署失败并显示错误:“无法加载文件或程序集'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: 为解决该问题,我在运行VS 2013的计算机上下载并安装了最新的Web Deploy软件包。当时,最新版本为3.5:

Web Deploy 3.5 Web部署3.5

This comes with the dependency dll that's needed for the client. 这附带了客户端所需的依赖dll。 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. 奇怪的是,我没有必要在运行相同版本的VS 2013的家用机器上做这个部分,所以我不知道为什么在这个特殊情况下这是必要的。

After all of this was completed, I was able to deploy my web app remotely as admin. 完成所有这些后,我能够以管理员身份远程部署我的Web应用程序。 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. 由于安全问题,我不建议在主机上为管理员设置Web部署,但我上面链接的演练显示了如何为远程连接创建用户帐户。

Edit: I also found a great troubleshooting guide that helped me fix a problem: Web Deploy Troubleshooting 编辑:我还找到了一个很好的故障排除指南,帮助我解决了一个问题: Web部署故障排除

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. 我们使用内置的Visual Studio Web发布 ,并将其与web.config转换相结合,为每个环境部署适当的配置(设置,连接字符串等)。

Once set-up it really is as simple as selecting the publishing profile you want and pressing 'Publish'. 设置完成后,就像选择所需的发布配置文件一样简单,然后按“发布”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将 ASP.NET MVC 5 应用程序部署到 Windows Server 2008 R2 上的 IIS 7.5 - Deploying ASP.NET MVC 5 Application to IIS 7.5 on Windows Server 2008 R2 如何将ASP.NET MVC应用程序部署到Windows Server 2008 IIS 7.5上? - How to Deploy an ASP.NET MVC Application onto Windows Server 2008 IIS 7.5? Windows Server 2008 R2上IIS 7.5上的ASP.NET MVC 4无法呈现CSS,JS - ASP.NET MVC 4 on IIS 7.5 on Windows server 2008 r2 does not render css, js 使用IIS 7.5部署ASP MVC 5应用程序 - Deploying ASP MVC 5 App with IIS 7.5 在IIS 7.5上运行的ASP.NET MVC 2 Beta中的应用程序 - Application in ASP.NET MVC 2 Beta running on IIS 7.5 在IIS 7.5上运行Intranet ASP.NET MVC 3应用程序 - Running intranet ASP.NET MVC 3 application on IIS 7.5 将ASP.NET MVC应用程序的IIS 7.5应用程序池标识配置为SQL Server 2008 R2上的登录 - Configuring ASP.NET MVC app's IIS 7.5 Application Pool identity as login on SQL Server 2008 R2 如何避免在IIS 7.5的子路径中部署ASP.NET MVC3应用程序 - How to avoid deploying ASP.NET MVC3 application in subpath on IIS 7.5 在IIS 7.5上部署ASP.NET MVC应用程序时出现“未配置默认文档”错误 - Getting “A default document is not configured ” error when deploying ASP.NET MVC application on IIS 7.5 IIS 7.5 asp.net应用程序未运行 - IIS 7.5 asp.net application not running
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM