Automatically update local client website that running on IIS manager - c#

I have a website that running locally on IIS Manager. Every time when I update website, I communicate client via Anydesk and update its file. Whenever the client got any update from server than it should be automatically updated.
I got it solution to push dll file on GitHub. When customer click on update button GitHub file download automatically in where website hosted folder. The problem is here when I replace updated file, it will give an error 'The process cannot access file, because it already used'.
If this solution is correct, kindly guide me how to overwrite file while application running on IIS manager without stop application
Otherwise give me suggestion to update file from online window server to local IIS manager without closing application.

Currently, in ASP.NET Core apps, it is impossible to replace binaries when the application is still running, but it will possible in .NET 6 by Shadow-copying in IIS.

You should consider the Blue Green deployemnt for your app https://docs.cloudfoundry.org/devguide/deploy-apps/blue-green.html
Options that I can suggest for your:
Move app to the cloud provider and use their features. For example Azure has Load Balancer/Traffic Manager/Slot deployment that can solve your issue
You can play with IIS Load Balancer: https://learn.microsoft.com/en-us/iis/web-hosting/scenario-build-a-web-farm-with-iis-servers/configuring-step-3-configure-iis-web-farm-load-balancing#:~:text=To%20configure%20load%20balancing%20with,Open%20IIS%20Manager.&text=Under%20the%20server%20node%2C%20expand,list%2C%20and%20then%20click%20Apply.

Related

Umbraco 8 shows install screen after deploying on GoDaddy server

I have developed site using Umbraco 8 and uSkinned theme. I am able to run in my local development environment as well as local IIS. but when I deploy it to GoDaddy it shows me install screen.
I followed below are the steps.
Visual Studio Publish to folder.
Using above published folder I hosted site to my local IIS(it works on IIS)
I have created backup of database
Restored backup to GoDaddy SQL Server. I checked after restoreing, tables and data is there on GoDaddy SQL Server(I used LinqPad).
I used publish output created on step 1 and updated connection string and uploaded to GoDaddy.
When I browse site it shows me install screen.
Why it shows me install screen even if it has data in database as well as same set of file as IIS local? What I am missing.
Thanks for help
Edit
I get below logs
{"#t":"2021-03-24T11:50:03.7387476Z","#mt":"{EndMessage} ({Duration}ms) [Timing {TimingId}]","EndMessage":"Booted.","Duration":1592,"TimingId":"6f43df2","SourceContext":"Umbraco.Core.Runtime.CoreRuntime","ProcessId":1700,"ProcessName":"w3wp","ThreadId":29,"AppDomainId":3,"AppDomainAppId":"LMW3SVC8ROOT","MachineName":"S107-180-73-24","Log4NetLevel":"INFO ","HttpRequestNumber":1,"HttpRequestId":"75319e5f-ad35-4c7b-9aa2-fe04a05c9007"}
{"#t":"2021-03-24T11:50:04.1450357Z","#mt":"New url {Url} detected, re-discovering application url.","Url":"http://yourmodern.skinfogroup.com/umbraco","SourceContext":"Umbraco.Core.Sync.ApplicationUrlHelper","ProcessId":1700,"ProcessName":"w3wp","ThreadId":16,"AppDomainId":3,"AppDomainAppId":"LMW3SVC8ROOT","MachineName":"S107-180-73-24","Log4NetLevel":"INFO ","HttpRequestNumber":2,"HttpRequestId":"7f3c5e24-22d0-4cc8-940d-13b6e8622a9f"}
{"#t":"2021-03-24T11:50:04.1450357Z","#mt":"ApplicationUrl: {UmbracoAppUrl} (UmbracoModule request)","UmbracoAppUrl":"http://yourmodern.skinfogroup.com/umbraco","SourceContext":"Umbraco.Core.Sync.ApplicationUrlHelper","ProcessId":1700,"ProcessName":"w3wp","ThreadId":16,"AppDomainId":3,"AppDomainAppId":"LMW3SVC8ROOT","MachineName":"S107-180-73-24","Log4NetLevel":"INFO ","HttpRequestNumber":2,"HttpRequestId":"7f3c5e24-22d0-4cc8-940d-13b6e8622a9f"}
{"#t":"2021-03-24T11:50:04.5356961Z","#mt":"Umbraco must install or upgrade.","#l":"Warning","SourceContext":"Umbraco.Web.UmbracoModule","ProcessId":1700,"ProcessName":"w3wp","ThreadId":16,"AppDomainId":3,"AppDomainAppId":"LMW3SVC8ROOT","MachineName":"S107-180-73-24","Log4NetLevel":"WARN ","HttpRequestNumber":2,"HttpRequestId":"7f3c5e24-22d0-4cc8-940d-13b6e8622a9f"}
EDIT 2
I validated that connection string correct. I am able to connect to the database and execute queries. I have also validated that it has same no of tables and rows.
This Umbraco forum thread says it could be a permissions issue: https://our.umbraco.com/forum/using-umbraco-and-getting-started/102946-moving-umbraco-v8-to-new-server-fails-you-see-this-screen-because-your-umbraco-installation-did-not-complete-correctly#comment-322275 - specifically the part in there about
changed the permissions on the server (by creating a new sql server
user and login with the same rights)
Heres my debuggin tips:
Have you upgraded? Have you copied the DB into live, or, you using a fresh DB?
How are you doing your transforms? Perform a file compare between files using a tool like Beyond Compare
Delete contents of Add_Data
Install screen can be triggered if Umbraco.Core.ConfigurationStatus is not populated
See this for details:
https://www.jondjones.com/learn-umbraco-cms/umbraco-7-tutorials/umbraco-upgrading-guide/how-to-reinstall-umbraco/
There was issues with the server. I validated this by.
Hosting same website on other server(works)
Hosting website with default data on same server(does not works).
Edit
Rebuilding server did not fix the issue.

How to upload my publisher file without stopping IIS in ASP.NET Core?

When uploading the ASP.NET Core publish file to a server error using another process, and when stopping, IIS allows uploading my file.
How to upload my publisher file without stopping IIS?
Based on this issue here: https://github.com/aspnet/IISIntegration/issues/238
If you are publishing to an IIS server, have you tried using the MSDeploy profile instead of FileSystem? If it is an MSDeploy profile, you can set the following property in the pubxml (under Properties\Publish Profiles)
<EnableAppOffline>true</EnableAppOffline>
This will take care of bringing the site down before publishing. You should not run into issues with deleting files with this profile.
Publishing to a folder does not know if it is getting published to a live site or just a folder on the machine. Hence, it does not handle stopping the site before publishing. MSDeploy profiles are specifically meant to handle these scenarios (publishing to IIS etc).
Unfortunately, it seems that there is no way to patch dlls without restarting the app pool yet.
If you don't want to stop iis then you could try to recycle the iis application pool which is used by the web application you are trying to redeploy.
Open IIS Manager
Right-click the AppPool
Choose the recycle option from the action

TFS CI build to Azure Web App (App Service) fails due to file locking (msvcr100.dll)

Problem
Getting a deployment error when trying to publish to an Azure Web App from TFS CI. A file is locked and this prevents the build from updating.
Symptoms
Publishing manually (Web Deploy publish from within Visual Studio) usually succeeds.
Stopping the Web App and publishing allows it to succeed, however this defeats the point of our CI if we need need to stop and start the Web App each time.
CI publish to Web roles and Worker roles don't appear to have this issue, we only get it on publishing to Web Apps (formerly Web Sites, the current Azure Portal term is now App Service).
Only publishing from a CI build via TFS fails consistently in this way.
Error
Web deployment task failed. (Web Deploy cannot modify the file
'msvcr100.dll' on the destination because it is locked by an external
process. In order to allow the publish operation to succeed, you may
need to either restart your application to release the lock, or use
the AppOffline rule handler for .Net applications on your next publish
attempt. Learn more at:
http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_FILE_IN_USE.)
The information at the link isn't very helpful.
ERROR_FILE_IN_USE
Diagnosis – A destination file cannot be overwritten or deleted because it is currently in use.
Resolution – Make sure that the destination file is not in use before performing a sync. If you are syncing content to a web site
hosted on IIS 7 or later (using the appHostConfig, iisApp, or
contentPath providers), consider taking the application offline during
the sync by enabling the appOffline rule.
Attempted resolutions
We were using New Relic - have since removed New Relic and this issue still persists. The binary appears to be a Microsoft library but it's unclear how it is relevant to the application (it's not referenced).
Some other SO questions have addressed similar issues with publishing but none of these relate to getting this issue from TFS CI.
azurew website continious deployment - Web Deploy cannot modify the file 'XXX' on the destination because it is locked by an external process
How to take web app offline while publishing?
One answer in the above question suggests using the EnableMSDeployAppOffline configuration in the publish profile, and adding this configuration works OK for doing a publishing manually from within VS but it doesn't fix the problem when publishing automatically from TFS/CI.
Edit
How to take web app offline while publishing? deals with taking the app offline using the EnableMSDeployAppOffline configuration - unfortunately this config only seems to be supported when doing WebDeploy through Visual Studio (not CI).
You can use the Web Deploy v3 in CI to deploy your web app.
In Web Deploy V3, we added support to automatically take an ASP.Net
application offline before publishing to it. This is useful if a user
wants to ensure that their application does not have a lock on a file
(e.g. SQL CE sdf files which only allow one connection to the file at
a time) being overwritten, or if they want to ensure that visitors to
their site cannot affect the publish process. When the publish process
is completed, the App_Offline.htm file will be removed and the site
will be online again.
Or you can add a PowerShell script like following to deploy the web app to Azure:
param($websiteName, $packOutput)
$website = Get-AzureWebsite -Name $websiteName
# get the scm url to use with MSDeploy. By default this will be the second in the array
$msdeployurl = $website.EnabledHostNames[1]
$publishProperties = #{'WebPublishMethod'='MSDeploy';
'MSDeployServiceUrl'=$msdeployurl;
'DeployIisAppPath'=$website.Name;
'Username'=$website.PublishingUsername;
'Password'=$website.PublishingPassword}
Write-Output "Stopping web app..."
Stop-AzureWebsite -Name $websiteName
Write-Output "Publishing web app..."
$publishScript = "${env:ProgramFiles(x86)}\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Web Tools\Publish\Scripts\default-publish.ps1"
. $publishScript -publishProperties $publishProperties -packOutput $packOutput
Write-Output "Starting web app..."
Start-AzureWebsite -Name $websiteName
Reference from: https://msdn.microsoft.com/en-us/Library/vs/alm/Build/azure/deploy-aspnet5
The new "Deploy AzureRM Web App" task has an option to take the app offline which will prevent this error.
See screenshot for checkbox

Update Javascript libraries when deploying a web application to Windows Azure

I have an MVC4 web application that uses jquery and some other libs (jquery-ui in particular).
Yesterday I decided to update all the packages via NuGet package manager; my web application worked correctly on my local machine, but when I deployed it to my azure website a javascript error popped out in my browser (it was related to jquery-ui library, something like "$browser is not a function").
I searched the web and found out that the cause of this error was that I was still using an old version of jquery. It seems that deploy process didn't publish the new version of the js libraries even if they have been updated in local project.
I solved the problem connecting via RDP to the Azure machine, deleting the contents of "Scripts" folder and deploying again, but I'm wondering if there's a way to "force" script/libraries update when deploying to Azure.
Edit 1: I'm developing with Visual Studio 2012, using Mercurial as source control provider
Edit 2: I'm deploying to Azure Web Sites
Please, in your future questions clearly indicate what type of Azure Service do you use. An MVC4 web application can be deployed to 3 different type of services: Azure Web Sites, Azure Cloud Service, Azure Virtual Machine!
Since you are talking about RDP, the viable options are Cloud Service or Virtual Machine. But then you say
I solved the problem connecting via RDP to the Azure machine, deleting
the contents of "Scripts" folder and deploying again, but I'm
wondering if there's a way to "force" script/libraries update when
deploying to Azure.
Now the question is how you do deploy to Windows Azure? Is it via Visual Studio's Publish feature to Azure Cloud Service. Is it Visual Studio's Package feature and then using any other method of deployment (upload the package from the portal, use Azure PowerShell cmdlets, or use third party tool to deploy the package)? Is it integration with Mercurial and deployment is done automatically when you check-in?
Any any case, the issue you face is a mixture of NuGET failing to do real clean update of everything. Browser caching - especially for local development - IE caches all the scripts, CSS and images and it is hard to say (without explicitly deleting all locally cached files) which script are you actually using. Simple version control issue - keeping old and new scripts.
When you do a JS/CSS updates I strongly advise all the customers to first delete all browser's cache (crtl+shift+del - works for all browsers) before testing locally.
I highly doubt that if you use a Cloud Service, RDP-ing and deleting anything in the sitesroot folder will help you when you redeploy. What you do in the ROLEROOT drive (usually E:, sometimes F: drive) is dropped of/forgotten when you re-deploy regardless of the re-deploy method you use: in-place-upgrade or full re-deploy. So what you did is actually creating new package and re-deploying your new package.
The fact that you deleted some folder has no effect on your re-deploy action.

ClickOne updating application on local machine

I am working on VS 2010 with .net 4 (OS: Windows XP). I want my application to have update feature. I have only one computer. How can i deploy the application it to test the update feature?
Currently i am publishing my application in a folder in my documents
I tried publishing to local FTP using XAMPP but it was unable to check for updates on FTP.
Now i have installed IIS to make a local HTTP server to deploy my application there but it asks for Front Page Server Extension then was asking Front Page.
All i need is that my application can update it self. Original requirement was patch update but i don't know how to do that. I think using ClickOnce is enough.
Create a network share on your local machine and publish to that; when you install the application, make sure to install it via the network share too.

Categories

Resources