MSdeploy部署与错误的虚拟目录名的MVC 2应用程序 [英] MSdeploy deploys an MVC 2 application with wrong virtual directory name

查看:212
本文介绍了MSdeploy部署与错误的虚拟目录名的MVC 2应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的MSBuild(v4.0.30319.1)和MSdeploy(v7.1.618.0)部署在IIS(V7.5)我的ASP MVC 2应用程序。
下面是我跑做的命令:

I'm using MSbuild(v4.0.30319.1) and MSdeploy(v7.1.618.0) to deploy my ASP MVC 2 application on IIS(v7.5). Here are the commands I run to do it:

msbuild.exe <path to my csproj>/MyMvcApp.csproj /t:Package /p:configuration=release;outDir=<my output dir>

和msdeploy:

msdeploy.exe -verb:sync -source:package='<MSBuildOutputDir>\_PublishedWebsites\Webui_Package\MyMVCApp.zip' -dest:auto 

构建和部署应用程序被部署地址后的http://本地主机/ MyMVCApp_deploy ,而不是由地址的http://本地主机/ MyMVCApp
我没想到的是, _deploy 将在地址。
我该如何解决这个问题?

After build and deploy the application is deployed by address http://localhost/MyMVCApp_deploy and not by address http://localhost/MyMVCApp. I did not expect that the _deploy will be in the address. How can I fix this?

推荐答案

由于Portalus评论,你可以控制在属性页的应用程序的名称。我会扩大这里回答一下。

As Portalus commented you can control the name of the app in the properties page. I'll expand a bit on that answer here.

PP / Web选项卡上配置的默认值

这是当你打包/发布Web项目,我们将创建一个名为Web部署参数的默认值 IIS Web应用程序名称控制这个值。这种情况的默认值是
ProjectName_deploy 。为什么我们把_deploy后缀有IIS的情景的原因。所以,你可能已经有名称的IIS应用程序的项目名但它不太可能,你将有一个名为 ProjectName_deploy 。您可以自定义上的包装这个值/发布Web 的项目属性的选项卡。有一点要记住,如果你走这条路线是,所有这些设置都绑在特异性的生成配置即可。所以,如果你对配置的调试的设置和使用创建程序包的发布的这些设置将不适用。参见下图。

By default when you package/publish your web project we will create an Web Deploy parameter named IIS Web Application Name which controls this value. The default value for this is ProjectName_deploy. The reason why we put the _deploy suffix there is for IIS scenarios. So you may already have an IIS app with the name of ProjectName but its much less likely that you will have one named ProjectName_deploy. You can customize this value on the Package/Publish Web tab of the project properties. One thing to keep in mind if you go this route is that all of these settings are tied to a specif build configuration. So if you configure the settings on Debug and the create your package using Release those settings will not apply. See image below.

当您设置此值时,它设置的MSBuild属性,DeployIisAppPath,如果你想拥有与它得到的价值一定逻辑分析,你可以使用。

When you set this value it sets the MSBuild property, DeployIisAppPath, and you can use that if you want to have some logic relating to the value it gets.

如果你愿意,你也可以只指定此参数的值,当你发布。你这里有两种主要的方法。

If you want you can also just specify the value of this parameter when you are publishing. You have two primary approaches here.


  1. 指定为个人财产
  2. 价值
  3. 在一个文件中指定此和其他属性值

呼吁msdeploy.exe给该参数的新值时,您可以使用-setParam参数。例如:

1. Specify the value for the individual property:

You can use the -setParam parameter when calling msdeploy.exe to give a new value for that parameter. For example:

%msdeploy% -verb:sync -source:package=WebApplication3.zip -dest:auto -setParam:name="IIS Web Application Name",value="Default Web Site/FooBar"

2。在文件中指定此和其他属性值

当您创建一个包VS我们自动为您创建一个名为{}项目名的文件.SetParameters.xml。这个文件是一个简单的XML文件,它包含所有的参数,用自己的缺省值一起。您可以更新该文件以包含正确的参数值,然后将其传递到msdeploy.exe(注:文件没有透露姓名... SetParameters.xml你可以将其重命名为任何你想要)。如果你想用这种方法,然后调用msdeploy.exe时,只需使用-setParamFile参数。以下是此命令行语法的示例:

2. Specify the value for this and other properties in a file

When you create a package in VS we automatically create for you a file named {ProjectName}.SetParameters.xml. This file is a simple XML file and it will contain all the parameters, along with their default values. You can update that file to include the correct parameter values and then pass it into msdeploy.exe (note: the file doesn't have to be named ...SetParameters.xml you can rename it to whatever you want). If you want to use this approach then just use the -setParamFile parameter when calling msdeploy.exe. Here is an example of the command line syntax for this:

%msdeploy% -verb:sync -source:package=WebApplication3.zip -dest:auto -setParamFile=WebApplication3.SetParameters.xml

这篇关于MSdeploy部署与错误的虚拟目录名的MVC 2应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆