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.
Related
I have a Blazor client/server app that I have been working on for a period and it has been working fine up to now. I suddenly started getting this error
Failed to find a valid digest in the 'integrity' attribute for
resource 'https://mydomain.no/_framework/Faso.Blazor.SpinKit.dll'
with computed SHA-256 integrity
'1UEuhA1KzEN0bQcoU0m1eL4WKcCIWHhPgoXydAJnO9w='. The resource has been
blocked.
Failed to find a valid digest in the 'integrity' attribute for resource
I have tried to clean and rebuild. I have tried to add Cors, set folder permission, and many other suggested solutions, but to no avail. I am using web deploy in VS 2022 and Win Server 2016, .net core 5.0.
Any suggestions would be appreciated.
This is an annoying issue indeed and I'm getting that error every now and then. It seems to happen after updating some packages, and the build processes fails to pick up the new SHA for the package.
You can verify that this is the issue by finding the file containing the SHAs and compare the SHA for the dll in question with the SHA from the error message.
This file is called blazor.boot.json and is generated deep inside the obj-folder of your project folder.
(mine was here: obj\Release\net6.0\win-x86\PubTmp\Out\wwwroot\_framework)
If was the issue, please try this:
Close VS.
Delete the obj and bin folders from all your projects. (the web project might be enough, but hey - can't hurt)
Start VS
Rebuild solution.
Try Publish again.
All answers here are great.
The only caveat to my solution was that I was using a hosted Blazor WASM model. Since we publish our Server application, it takes the liberty to build the Client for us. After seeing every single solution say to delete your bin and obj folder and then banging my head on every wall in our office it finally dawned on me that I don't need to be deleting the bin and obj from my "Server" project and that I might need to go to the Client project and do that.
It might sound simple enough in hindsight, but coffee failed me this morning. At the expense of my pride.. hopefully this can be someone's light bulb answer. Sometimes YOU are the little things. :D
I finally solved it for my own issue! This issue has been plaguing me for weeks.
I had tried all of the things mentioned here and elsewhere, and none of it worked. What did work was using my ftp client (filezilla) and changing the transfer type from "auto" to "binary" (Transfer > Transfer Type > Binary). I don't see an option for doing this in VS2022, so I guess I'll use my manual ftp client solution for now.
Aaaahhhhh.
Check this note from: https://learn.microsoft.com/en-us/aspnet/core/blazor/host-and-deploy/webassembly?view=aspnetcore-6.0
Resolve integrity check failures:
When Blazor WebAssembly downloads an app's startup files, it instructs the browser to perform integrity checks on the responses. Blazor sends SHA-256 hash values for DLL (.dll), WebAssembly (.wasm), and other files in the blazor.boot.json file, which isn't cached on clients. The file hashes of cached files are compared to the hashes in the blazor.boot.json file. For cached files with a matching hash, Blazor uses the cached files. Otherwise, files are requested from the server. After a file is downloaded, its hash is checked again for integrity validation. An error is generated by the browser if any downloaded file's integrity check fails.
If after deleted obj and bin folders the error continues, be sure that you are deleting the cache on your client browser of the site (Ctrl + F5)
My solution is also so interesting. I put my web api service and Blazor Wasm projects into same server with different subdomains. Both of them are using .Net 6.
Although Web Api works well, Blazor gave that error. I tried everything on the StackOverflow, none of them worked. Then I tried to move Blazor project to another server that another Blazor Wasm is already working and Bingo!
While it gave problem in Windows Server 2022 with IIS 10.0.20348.1 and .Net Core Hosting Bundle 6.0.7; it worked in first try with the same files in Windows Server 2019 with IIS 10.0.17763.1 and .Net Core Hosting Bundle 6.0.6
I am really so surprised that why it gave error in new server and I couldn't understand where is the problem exactly (Server edition, IIS or .Net minor version differences)
I hope it helps to someone that couldn't solve problem yet.
For me (I've updated the SDK from .NET 6 to 7), the solution was the following order of action:
Clear all bin and obj folders
Clear all nuget cache instruction
Run the app and clear the browser cache (Ctrl+F5)
For me it was wrong MIME Types.
There was a web.config with changes to Mime types, but I needed to mannually change it for my Blazor Page in IIS.
After this it worked
Web.config in Publish folder contained a section like this:
<remove fileExtension=".blat" />
<remove fileExtension=".dat" />
<remove fileExtension=".dll" />
<remove fileExtension=".json" />
<remove fileExtension=".wasm" />
<remove fileExtension=".woff" />
<remove fileExtension=".woff2" />
<mimeMap fileExtension=".blat" mimeType="application/octet-stream" />
<mimeMap fileExtension=".dll" mimeType="application/octet-stream" />
<mimeMap fileExtension=".dat" mimeType="application/octet-stream" />
<mimeMap fileExtension=".json" mimeType="application/json" />
<mimeMap fileExtension=".wasm" mimeType="application/wasm" />
<mimeMap fileExtension=".woff" mimeType="application/font-woff" />
<mimeMap fileExtension=".woff2" mimeType="application/font-woff" />
This conflicted with the Mime Settings in IIS
After I changed the Mime Settings in IIS to the values from the web.config, it worked.
For me, it happens if I run the same blazor app in the same browser user but with different domains. ex:
'mywebsite.z13.web.core.windows.net' and 'mywebsite.com'
Delete the cache, and run only 1 domain per browser user.
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 written a PageAdapter that handles viewstate persistence in a SQL server. This page adapter was created in it's own project so that i can reuse the DLL on other projects.
I have another project that is acting as my test web application. I added an entry the configuration file for the new database connection string. I also had to create a browser file in the app_browser folder. I will tell you upfront that I am not familiar with the app_browser and browser files at all. So this is probably a setup issue.
I have this solution working properly on development. I then tried to deploy my project using a web deployment project to compile the application, and then manually move the output to the test server. On the test server, it acts like it is not reading the app_browser folder. My code never gets executed. I started up a remote debugging session and my code never fired. All of the necessary files are there.
The server is windows server 2003 standard edition with SP 2. It is 32-bit. It is running IIS 6.0. We have all of the .Net frameworks installed. IIS is currently configured to run framework 4.0. My code is using 2.0.
I am not finding a whole lot of information online about it, but I know I can't be the first to have this issue. Please someone help me out here.
Below is the contents of my browser file.
<browsers>
<browser refID="Default">
<controlAdapters>
<adapter controlType="System.Web.UI.Page" adapterType="BEKCustomViewState.BEKViewStatePageAdapter"/>
</controlAdapters>
</browser>
</browsers>
Well, this doesn't explain what caused the issue, but it is definitely a viable workaround. I will probably implement this in my deployment project so that I don't have to worry about it.
http://conficient.wordpress.com/2010/05/11/fix-for-precompiled-websites-from-vs2010-on-net-3-5-for-cssfriendly-adapters/