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

1

3

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?

Chesterton answered 3/9, 2012 at 2:22 Comment(0)
D
3

Change your parameterEntry's scope to "application":

<parameterEntry kind="DeploymentObjectAttribute" 
                scope="application" 
                 match="application/@applicationPool"/> 
Dangerfield answered 27/9, 2012 at 22:17 Comment(5)
I have seen this answer elsewhere, but doesn't seem to work for me... How does this get used by MSDeploy anyhow?Heterophyte
@Heterophyte - It can only change the property if it's there to begin with. Open the package (sync to one if you're working with a non-package source) and have a look at the archive.xml. If you don't see an <application /> element with an applicationPool attribute, then the parameter won't do anything as there's nothing to change.Dangerfield
ok, that's my problem. How can I get an <application /> section generated in my archive.xml? I'm using msbuild to create my packageHeterophyte
@Heterophyte - Ask as a separate question (tag it as msdeploy), and I'll take a look. These comments aren't intended to be discussion forums :)Dangerfield
sorry you are right, I've created a new question: #13595170. Thanks for your helpHeterophyte

© 2022 - 2024 — McMap. All rights reserved.