I´m trying to configure the application pool to .NET v4.5 Classic from the default DefaultAppPool for a web service deployed in IIS 10, developed with Visual Studio 2019.
These are my steps:
I created a file called parameters.xml in the root with the following content:
<parameters>
<parameter name="appPool" defaultValue="SealSignAppPool">
<parameterEntry kind="DeploymentObjectAttribute" scope="application" match="applicationPool/#applicationPool" />
</parameter>
</parameters>
Create the package from right click on the project -> publish:
The package is created and I can view the parameter correctly configured inside parameters.xml in the deploy zip:
After deploy, the Application Pool remains the default.
NOTE: If I use Import Application Wizard with the zip deploy, I can see the parameter, but in the import log says it can´t be applied to any site...
======================================================================
== UPDATE 1 ==
I´ve added in Web Deploy Package.pubxml the missing properties:
<IncludeIisSettings>true</IncludeIisSettings>
<IncludeAppPool>true</IncludeAppPool>
With only IncludeAppPool nothing changes.
With IncludeIisSettings added I have a exception and the package publish fails with "EscapeTextForRegularExpressions" task was not given a value for the required parameter "Text"
I searched and the recomendations are set IncludeIisSettings to false... :(
Any idea what I missing??
Thank you.
Related
We have a continuous delivery process created using Jenkins, MSBuild, and Web Deploy. Things work beautifully when deploying to our development server, however, when I try to deploy a web deploy package using the *.deploy.cmd file on two newly configured servers the web.config changes defined in the parameters.xml file are not being applied. The rest of the deployment works great but I am seeing a message like this for every parameter that needs to change:
Verbose: Parameter entry 'config/1' could not be applied to '<path>\Package\PackageTmp\Web.config'. Deployment will continue with the original data. Details:
Cannot set a value on node type 'Element'.
Since the transforms for the exact same package work on deployments to one server and not to the new servers, this seems like a server configuration issue but I've gone through and checked everything against Microsoft's Web Deploy install instructions and it all looks fine. I wasn't the person who originally set up Web Deploy on the working folder so I don't know what they might have done differently. I suspect this is related to permissions but the few places I can think to check were the same on both servers.
I found other questions with this error message where it was an issue with the XPath in their parameters.xml file. I don't think this is my problem because I can deploy successfully to one of my servers but here's an example from my paramters.xml and SetParams.xml files for good measure:
parameters.xml
<parameter name="config">
<parameterEntry kind="XmlFile" scope="\\web.config$" match="//configuration/appSettings/add[#key='config']" />
</parameter>
*.SetParameters.xml
<parameters>
<setParameter name="config" value="<add key="config" value="testing" />" />
</parameters>
Does anyone know how to fix this or what kind of additional permissions I will need on my new servers?
In retrospect this is embarrassingly obvious but it turns out that our issue was that the server support team had installed the wrong version of Web Deploy. We needed 3.5 or higher and they installed 2.10. Updating Web Deploy on the new servers resolved the issue.
Using Visual Studio 2015 update 3
and Team Foundation server Update 3 (on-site)
I'm attempting to setup up and auto deploy for a .net core boilerplate app targeting full framework 4.61. Currently my app is mostly the stock app you get when selecting new->Project->Templates->Visual C#->Web->ASP.NET Core Web Application(.Net Framework). My Goal is to Push via Git and then have the website show up correctly on the test server.
I was able to use the instructions I found at the MVA
However, they did not go into any detail on how to deploy to an on-prem server. But they clearly stated that it was possible.
I have Setup this web project in TFS2015 using Git as source control. For my Build Definition I'M using the Visual Studio default build ScreenShot of TFS build Definition, I also have the site building whenever I push new code.
The problem I have is I don't understand what to do next.
my thought is that I would need to:
turn off IIS (iisreset -stop) via PowerShell.
Move the built files to my iss location. In this example, it is C:\inetpub\apps\My
run scripts to update database schema(note currently there is no database setup but that is my next step. planning to use "code first" with "Entity Framework"
I would have to turn IIS back on.
I did get a big clue to add the following in my Visual Studio Build Step. MSBuild Arguments.
/p:DeployOnBuild=True /p:DeployDefaultTarget=WebPublish
/p:WebPublishMethod=FileSystem /p:DeleteExistingFiles=True
/p:publishUrl=$(build.artifactstagingdirectory)\for-deploy\website
From Benjamin Day Blog www.benday.com/2016/09/08/an-asp-net-mvc-site-thats-easy-to-deploy-from-a-tfs-build/ (sorry can't link due to lack of rep points)
using those build MS build arguments I can find my built website and it appears to be working correctly except for the Web.config file is showing
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>
When is should be
<aspNetCore processPath=".\My.Multnomah.exe" arguments="" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" />
My Release Definition is in three steps
PowerShell on Target Machines
Machines = the server I'm going to deploy to
Admin Login = My AD username.(will switch to service account after working)
Protocol = Https
PowerShell Script = file location on the Script I have on the agent PC/which is also the test web server
here is the PowerShell script to turn of IIS.
iisreset -stop
Windows Machine File Copy
this step is working correctly
PowerShell on Target Machines
same as step 1. but
Currently, the Release is working if I manually turn off IIS then manually update the web.config file.
So, in short here are the questions?
How can I automatically Correct the web.config?
How can I arrange to have IIS Stopped before the file transfer and Started after the Transfer or is there a better way?(Current the release is failing if I don't have IIS off)
Is my understanding how I explained this correct/ What are the Build steps you would use to deploy on-prem?
1.How can I automatically Correct the web.config?
You can replace corresponding values with variable values (Open your build definition=>Variable) by using Replace Token task.
For example: Add variables to your build/release definition (e.g. name:LAUNCHER_PATH value:.\My.Multnomah.exe), change your web.config (replace %LAUNCHER_PATH% to #{LAUNCHER_PATH}# and others)
2.How can I arrange to have IIS Stopped before the file transfer and Started after the Transfer or is there a better way?
You don’t need to stop IIS before update web.config file, you can update it directly. After updating web.config, the website will be recycled automatically.
3.Is my understanding how I explained this correct/ What are the Build steps you would use to deploy on-prem?
These steps are ok, there are IIS Web App Deployment Using WinRM and IIS Utilities task that can help you to deal with IIS.
I am having a problem with Web Deploy packages recognizing SQL. I am using Visual Studio 2015, SQL Server 2014, SSDT Database Project. The workflow is, create a MVC project, create a Database project, and use the Web Deploy Package to run SQL queries on the DB project. I plan to Publish the MVC project into a web deploy package and add queries to the deployment as part of the package. (I am not trying DACPACs at the moment because I ran into issues where they were not including pre and post deployment scripts in them when using Web Deploy Tool).
The problem happens when publishing a web deploy package using the connection string below.
<connectionStrings configSource="connectionsettings.config">
That in the web.config prevents web deploy from detecting a database to add to the web package for web deploy packaging.
deloy package missing database
Whenever I change to a normal connection string, even something as simple as this:
<connectionStrings>
<add name="Default" connectionString="" providerName="System.Data.SqlClient" />
Then web deployment package works and you get the proper UI.
deloy package working
Anyone know how to get the database to show up using a configsource in the web.config connectionstrings? As an alternative, I was looking into getting parameters.xml to replace the blank connection string to include the configSource above, but have had no luck.
The idea was to remove the Default connection and replace it with the config source. Removing the default connection works but the configSource does not.
<parameter name="RemoveConnectionString" defaultValue="">
<parameterValidation kind="AllowEmpty" />
<parameterEntry kind="XmlFile"
scope="Web\.config$"
match="//configuration/connectionStrings/add[#name='Default']" />
</parameter>
<parameter name="AddConfigSource" defaultValue="connectionsettings.config">
<parameterEntry kind="XmlFile"
scope="\\web.config$"
match="/configuration/connectionStrings/#configSource" />
</parameter>
Web Deploy Package seems undeveloped for SQL, but is there a fix for my issue or a better way to do an all-in-one deploy for IIS & SQL?
Use WebDeploy Parameterization to manually create parameters for the separate config file.
Skip down to "Step 3 - Create a parameter file" in the following link:
http://www.iis.net/learn/publish/using-web-deploy/web-deploy-parameterization
This may also be helpful:
http://www.dotnetcatch.com/2014/09/08/parameterizationpreview-visual-studio-extension/
I have an MSBuild script that is generating a deployment script for my web app.
Project.build (excerpt)
<MSBuild Projects="xxxxx.sln" Properties="
CreatePackageOnPublish=true;
DeployOnBuild=true;
IncludeIisSettings=true;
IncludeAppPool=true;" >
<Output TaskParameter="TargetOutputs" ItemName="CompiledAssembly" />
</MSBuild>
When this is executed, it does produce a Package folder in the output that contains a deployment .cmd file and associated .zip file.
xxxx.SetParameters.xml (generated)
<?xml version="1.0" encoding="utf-8"?>
<parameters>
<setParameter name="IIS Web Application Name" value="Default Web Site\xxxxx" />
<setParameter name="DefaultConnection-Web.config Connection String"
value=" ... snipped ..." />
</parameters>
As you can see, there is no reference to app pool here. Likewise, there is mention of app pool in the generated xxxx.zip\parameters.xml
When I execute xxxxxx.deploy.cmd /Y, it correctly creates the application in IIS. The problem is, it seems to use the default application pool for the machine. It's a .net 4 app, so if the default is .net 2, the app fails to run.
Is there a way to make the deployment script include an app pool definition so that it won't require manual app pool changes to run?
I did find this question, which seems to be the same. However, as you can see, I've already included the answer from that question, and it has no effect.
If you're trying to deploy a 4.0 app to a 2.0 default app pool without providing an override it will not fail to run but fail to deploy, MSDeploy would simply fail to precreate a virtual app with ERROR_APPPOOL_VERSION_MISMATCH error.
IncludeAppPool is the correct property, but it only tells the packager to include the settings, you have to provide the source, i.e. the "master" virtual app with correct app pool to copy from.
Open project properties and switch from IIS Express to Local IIS, this will enable app pool flag under the package/publish options. I believe you can switch back afterwards, the settings will remain.
This would basically do 2 things, add <IncludeAppPool>true</IncludeAppPool> as well as add the master app under <WebProjectProperties> section. Now when you build or package your source manifest will not have the managedRuntimeVersion requirement but your parameters will now have IIS Web Application Pool Name to customize.
If you want to actually create a new app pool then it gets tricky. I'm not aware of a way to create it during iisApp creation or with some MSBuild flag, but with MSDeploy (the tool behind your .cmd) it would require a dump of your local pool and sync up with appPoolConfig provider, probably as part of your .build script before the .cmd call.
msdeploy -verb:sync -source:appPoolConfig=Foo -dest:package=foo.zip
msdeploy -verb:sync -source:package=foo.zip -dest:appPoolConfig=Foo,computerName=Bar
Keep in mind that without specifying individual appPoolConfig the sync, as it should, would destroy other pools, so do -whatIf first just in case.
You can probably try to merge the archive.xml of your package and the archive.xml with the app pool definition, but I can't image how it would work and what relationship between iisApp and appPoolConfig providers is there.
Edit: You can use manifest provider to combine package or iisApp with appPoolConfig
I have a standard ASP.Net application to which I added an Azure Deployment project to deploy to Azure. The app deploys fine to Azure.
I then wanted to extend it to have a startup task.
I added the following to the ServiceDefintion.csdef
<Startup>
<Task commandLine="startup.cmd" executionContext="elevated" taskType="simple"/>
</Startup>
startup.cmd is located in the applications bin folder. I have logging the command file so I can see it is not being executed.
When I deploy the same application to the Compute Emulator on my local machine the startup task executes correctly.
Am I missing something?
Your "startup.cmd" shall not just be in your app BIN folder, but instead in the root folder and marked as "Content" and "Copy to output directory" -> "Copy always". Otherwise it will not get deployed to the Azure.
Another moment to pay attention with Web Applications is that you most probably shall put the bin folder also in the startup task definition. Something like:
<Startup>
<Task commandLine="./bin/startup.cmd" executionContext="elevated" taskType="simple"/>
</Startup>
Hope this helps.
A bit late to the party.
I had this issue as well and for me it was that I had set the Web Role project to the startup project instead of the Azure Cloud Service project. By setting the Azure Cloud Service as the startup project you start the project with the azure emulator, which is needed to get start, run and stop events to work as in your azure environment.