I'm deploying an asp.net core web app to local IIS 8.5 with an Azure pipeline. Deployments are failing because the .dll of the site is locked by IIS. This is despite the fact that I explicitly stop the site, using a IIS Web App Manage task, before the deployment.
The specific error is...
ERROR_FILE_IN_USE Web Deploy cannot modify the file'MyApp.dll' on the destination because it is locked by an external process
Why is this. What do I have to do to get IIS to release the .dll and let my pipeline do its thing?
Update
I've tried a powershell script to create a App_offline.htm file. The file's created, but the following Web App Deploy task still fails with the same error.
Ok fixed it. I needed to stop the app pool in addition to the website. So in the IIS web app manage task, in Additional appcmd.exe commands, put
stop apppool /apppool.name:"MyAppPool"
Related
I have an IIS box on windows server 2012 and I want to mirror image the same settings, application pools, web sites and other configurations in another server that is also windows server 2012.
How Can I do that?
Is there any possibility to automate this process as I have to do this process very repetitively?
To Backup and Restore IIS configuration to Another Server you could try below steps:
1)if you configured the certificate with old iis site you need to Backup (export) of IIS certificates.
2)open the command prompt as administrator and create IIS configuration backup on the first server by using below command:
cd c:\Windows\system32\inetsrv
appcmd add backup srviis1-backup-2019
srviis1-backup-2019 this is a backup folder name.
After the command has been executed, a folder with your backup name appears in c:\Windows\system32\inetsrv\backup. Here is its contents for my simple website:
administration.config
applicationHost.config
MBSchema.xml
MetaBase.xml
redirection.config
3)Copy the backup folder to the same directory c:\windows\system32\backup on another server.
To display the list of all available backups, run the following command:
appcmd list backup
4)Recover IIS configuration from this backup:
appcmd restore backup srviis1-backup-2019
The list of restrictions and important issues:
The same IIS version has to be used on both servers
If any application pool is run not from the integrated accounts, they
have to be available on another server as well
Before recovery, you should export and migrate all current
certificates to the new server
I found a really genuine and effective way of migrating IIS(complete web application with all settings). It does not depend on IIS version also.
There is an API web deploy api that we can use to do this. We can do this using command line arguments or an IIS extension is also available for the same that will ease your IIS migration.
It can migrate
IIS Websites
Application Pools
Server certificates
Settings of application pools
Settings of websites
Authentication modes
MIME types
Directory Browsing
Output caching
Web binaries
And other related stuff and iis settings can be migrated using web deploy.
Go through https://www.microsoft.com/en-us/download/details.aspx?id=39277
and download web deploy for your IIS.
After a company forced Windows 10 update today, the Application Pool required by a local web application keeps stopping/crashing displaying the message
Service Unavailable
HTTP Error 503. The service is unavailable.
I have checked the the below similar posts and followed the solutions provided with no luck.
#1 - https://stackoverflow.com/questions/47338226/iis-10-0-apppool-crashing-causing-503-error
For hosting .Net Core applications in IIS, .Net CLR Version of
application pool should be No Managed Code as shown in below
screenshot.
#2 - https://stackoverflow.com/questions/50244861/iis-10-app-pool-keeps-stopping-due-to-aspnetcore-dll-failed-to-load
Go to the drive your IIS is installed on, eg. C:\inetpub\temp\appPools\
Delete the directory (or virtual directory) with the same name as your app pool.
Recycle/Start your app pool again.
I have also followed the Microsoft instructions. Made sure to first follow the steps in "Turn Windows features on/off) and then installing the ASP.NET Core hosting bundle as instructed.
#3 - https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/?view=aspnetcore-2.1&tabs=aspnetcore2x
I'm not having any luck.
Here's my setup App Pool
Here's my setup Site
I've done everything I know. Does anyone have this same experience and can share a solution?
As always, a big thank you to the experts out there!
UPDATE:
I created a new AppPool with Identity "ApplicationPoolIdentity" setting. The page will run however I need to connect to a SQL Server instance with my own credentials because we use Windows authentication on most of the pages. When I create a new AppPool with my credentials it will not stay running.
I develop simple Web Api on Net Core 2 and add Angular app to it (inside wwwroot folder) and publish it from my VS 2017 IDE to Azure Web App Service. All work fine, but when I reload page of my app in browser, server can't find route. So It often happens when iis not setup for SPA, It's described in https://angular.io/guide/deployment, I must configure the server to return the application's host page (index.html) when asked for a file that it does not have. How I can setup server node of iis in Azure Web App Service (web.config in Net Core 2 was deleted).
I am afraid you cannot achieve this.
Cause: Azure App Services runs IIS so it behaves mostly the same as local IIS, routing requests using a native module called AspNetCoreModule. So, it needs your published web.config file. Even though you deleted the web.config file, Azure would also generate a new web.config file to be used.(Though I don't understand why you delete the web.config file)
Solution:
Even you can upload the web.config file to Azure again, I'm afraid of that it will be ignored and doesn't work. So, I suggest you redeploy your website which contains web.config file to Azure and configure it well.
Additional: Azure Web App service is a kind of PaaS. So, if you want to install IIS manually, you can choose to host your website on a Windows Azure VM.
I'm trying to update a cloud service deployment on azure.
I can deploy fine to a test cloud service.
However, when I try to deploy to our production cloud service's staging slot the publish to azure from visual studio completes with no errors but in azure I don't see the new deployment in the staging slot.
I have verified that it deployed to the staging slot instances because I can Remote Desktop into each of the servers and see the new code in IIS.
The only errors I see are on the servers, where there are IIS event warnings regarding:
The application / belonging to site xxx has an invalid AppPoolId.
Site xxx was disabled because the root application defined for the site is invalid.
A process serving application pool xxx terminated unexpectedly.
Sure enough, when I browse the website the old site is running and not the new one.
Greatly appreciate any pointers!
Making sure we are on the same page...
- if you RDP into the staging deployment, you can verify that new code has been published
- when you browse to the website, you see the old code.
A couple of things to check...
When you say 'browse to the website', do you mean you attempted to reach the website via (1) a custom domain that points to the xxxxx.cloudapp.net, (2) directly at xxxx.cloudapp.net, or (3) {some long guid}.cloudapp.net?
Did you attempt to perform a VIP SWAP, and if so, when you click on SWAP, does the portal correctly reflect the date and time that the staging was deployed?
I have a Microsoft Azure Website and a virtual application running under it that I have configured. I am able to deploy both the main web application and the virtual application successfully by right clicking on each project and selecting publish. The main web application deploys to the site root, and my virtual application deploys to its sub directory (in this case it's /Api).
We keep our code under source control in Visual Studio Online which you can connect to an Azure website for continuous deployment. However, when I run the build for the virtual application (Api) it deploys it to the root of the site and not to /Api.
I have a number of other cloud services and websites utilizing CD already. It's the virtual application part that is giving me trouble.
The out of the box deployment build only deploys a single application. In this case your site.
To deploy multiple applications you need to use the DefaultTemplate.12.xaml and create a PowerShell to do your deployment in the post-test script step.
This problem will be fixed by a new build system being developed by MSFT...