How to specify default Application Pool in ASP.NET MVC Project?

浪子不回头ぞ 提交于 2019-12-07 15:43:07

问题


In my ASP.NET MVC project I have added a parameters.xml file that looks like:

<?xml version="1.0" encoding="utf-8" ?>
<parameters>
  <parameter name="Application Pool" description="Application Pool Name" defaultValue="PreferredPool">
    <parameterEntry kind="DeploymentObjectAttribute"
                    scope="appHostConfig"
                    match="application/@applicationPool"/>
  </parameter>
</parameters>

Then I go ahead and build the deployment package:

MSBuild.exe myproject.csproj /t:Package /p:PackageLocation="C:\packages\myproject.zip"

And then I invoke the batch script generated (myproject.deploy.cmd) and deploy the app to a local IIS 7 server. The problem is, it is always the Default Application Pool that is assigned to the app instead of the PreferredPool as specified in parameters.xml.

What did I do wrong?


回答1:


Change your parameterEntry's scope to "application":

<parameterEntry kind="DeploymentObjectAttribute" 
                scope="application" 
                 match="application/@applicationPool"/> 


来源:https://stackoverflow.com/questions/12241314/how-to-specify-default-application-pool-in-asp-net-mvc-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!