Deploying a ASP.Net Core web application via IIS - iis

I am having trouble deploying a ASP.Net Core 2.0 web application via IIS. My application builds and runs through VS but I cannot get the IIS instance to work.
I get the following error message:
HTTP Error 502.5 - Process Failure
Common causes of this issue:
- The application process failed to start
- The application process started but then stopped
- The application process started but failed to listen on the configured port
None of the troubleshooting steps have worked. I do not think the problem is with the application itself as when I run the following through command line:
"C:\Program Files\dotnet\dotnet.exe" C:\inetpub\wwwroot\MyApp\MyApp.dll
The application runs and I can view it at http://localhost:5000/
I have been through all the steps at https://learn.microsoft.com/en-gb/aspnet/core/host-and-deploy/iis/index?tabs=aspnetcore1x#common-errors and still have not made any progress.
This is what my WebHostBuilder method looks like:
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.UseApplicationInsights()
.Build();
host.Run();
and I use the following settings in my Startup.cs:
services.Configure<IISOptions>(options =>
{
options.AutomaticAuthentication = true;
});

That error can be for a number of reasons.
On you IIS server have you installed the .Net Core Runtime?
Is your application pool configured correctly?
Are your site bindings correct?
Check the install runtimes on your computer are the same you are trying to run on the project

Related

Azure Devops release to IIS fails after AOT blazor wasm

I have a .NET 7.0 blazor wasm app, that I deploy to a windows server running IIS. This has worked fine, until i added the following to my project (The client, and the project is .net core hosted):
<WasmEnableSIMD>true</WasmEnableSIMD>
<RunAOTCompilation>true</RunAOTCompilation>
First i got the following error in my build pipeline:
error NETSDK1147: To install these workloads, run the following command: dotnet workload restore
So i added a command line step to my build pipeline where i run the following command:
dotnet workload restore
So far so good. Now the project builds again. But my release now fails. I have 3 steps in my release pipeline for my IIS server:
Stop app pool
deploy my app
start my app pool
This worked fine before adding the two statements above. But now i get the following error:
Failed to deploy web package to IIS website.
Error: Unrecognized argument 'Files\IIS\Microsoft'. All arguments must begin with "-".
Error count: 1.
Error: The process 'C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe' failed
with exit code 4294967295
I can't seem to find a solution, so has anyone tried something similar?
Apparently i wasn't the only one with the issue:
https://github.com/microsoft/azure-pipelines-tasks/issues/17634
I ended up removing web deploy 4.0, and now it works again.
Maybe if I had waited longer, i wouldn't have to remove web deploy 4.0

AzureApp HTTP Error 500.30 - ASP.NET Core app failed to start

Works locally but NOT on Azure AppService
Using: Visual Studio 2022
Asp.Net MVC .NET 6
AzureApp Platform: Windows 32/bit
My App is a sample
I went through through from AzureAppSample
I am able to run it locally on mymachine. It is when I deploy to Azure using Visual Studio 2022 and then view my public URL that I get the error. When I look at the logs in Azure using Kudu I find "Application ...../ROOT' with physical root 'C:\home\site\wwwroot\' failed to load coreclr. Exception message: CLR worker thread exited prematurely</Data>"
Try adding the following to your configuration so that you can get a better idea of what the error is:
ASPNETCORE_DETAILEDERRORS = 1

netcoreapp2.1 upgrade to 3.1 leads to 502.5 error

I've had a deployed app on version 2.1 for a while. Locally, I'm running 3.1 with no issues. I finally deployed it and it lead to the dreaded 502.5 error. In the Azure Portal console:
> dotnet --info shows:
Version: 3.1.108
...
.NET Core SDKs installed:
<snip>
3.1.108[D:\Program Files (x86)\dotnet\sdk]
.NET Core runtimes installed:
<snip>
Microsoft.NETCore.App 3.1.8 [D:\...]
Checking the version: > dotnet --version gives 3.1.108
In the App Service Editor, I verified the Web.runtimeconfig.json shows:
{
"runtimeOptions": {
"tfm": "netcoreapp3.1",
"framework": {
"name": "Microsoft.AspNetCore.App",
"version": "3.1.8"
},
"configProperties": {
"System.GC.Server": true
}
}
}
However, it looks like Web.deps.json still references version 2.1. What other configs do I need to update? I assume this is part of the issue.
The 502.5 Process Failure error page is returned when the ASP.NET Core Module attempts to start the worker process but it fails to start. A common failure condition is the app is misconfigured due to targeting a version of the ASP.NET Core shared framework that isn't present.
The cause of a process startup failure can usually be determined from entries in the Application Event Log and the ASP.NET Core Module stdout log. You can try to set stdoutLogEnabled=true in the web.config file.
To view more details, you can reference to the articles below:
502.5 Process Failure
When a .NET Core Azure App Service won’t start: 502.5 Process Failure

HTTP Error 502.5 - Process Failure asp.net core 2.0

Problem
I already developed my web app and published it to azure with asp.net core 1.1 and it was working fine until I upgraded my web application to Core 2.0 final release and now the app working locally but when I deploy it to Azure It gives me this issue .
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
</ItemGroup>
I just update .csproj file with this line of code
HTTP Error 502.5 - Process Failure
Common causes of this issue:
The application process failed to start The application process
started but then stopped The application process started but failed to
listen on the configured port
Troubleshooting steps:
Check the system event log for error messages Enable logging the
application process' stdout messages Attach a debugger to the
application process and inspect
With a bit of searching this worked for me.
Essentially clean out the wwwroot folder from a console on your Azure Portal. Make sure you get the top most wwwroot folder (I had a sub wwwroot folder for some reason.)
RD wwwroot /S /D
Should do the trick. Then just republish your site. It would appear that the publish process does NOT delete anything that already exists within the deploy folder. So you have 1.1 .dlls and 2.0 .dlls.
Hope that does the trick for you.
I had same problem publishing a simple spike app using VS2017 15.7.1
- File | New Project, ASP.NET Core Web App, MVC, ASP.NET Core 2.0
- Build and run on local host
- Publish to Azure WebApp
Browser displayed error: HTTP Error 502.5 - Process Failure
I had the issue HTTP Error 502.5 - Process Failure, mine was fix by installing the .net sdk
https://www.microsoft.com/net/download/visual-studio-sdks
After upgraded to ASP.NET Core 2.0, you need to add following configuration section to all the .csproj files in the solution.
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
</ItemGroup>
You could create a new ASP.NET Core 2.0 application to check it. The DotNetCliToolReference configuration section is already in the new ASP.NET Core 2.0 application project file but missed in your upgraded application project file.
I was running 2.0.8, had to downgrade to 2.0.5 then it worked. The 2.0.8 didn't include a the Self-contained deployments (SCD) as supposed which 2.0.5 did.
I'm using VSTS to build and release

Why is Web Deployment Agent Service (MsDepSvc) crashing with a FileNotFoundException?

I'm attempting to deploy a .NET 4 web application to a Windows 2008R2 server using Web Deploy V2. As part of this deployment we copy some batch files to the target machine. When I execute the command below, Web Deployment Agent Service (MsDepSvc) stops and a FileNotFoundException is logged to the system Application event log.
The web deploy command:
"C:\Program Files (x86)\IIS\Microsoft Web Deploy V2\msdeploy.exe" -verb:sync -source:contentPath="C:\work\27f84e3eca3a33d5\Output\BatchFiles" -dest:contentPath="c:_DeployCommands",computerName="192.168.1.14"
Full console output:
C:\Windows\system32>"C:\Program Files (x86)\IIS\Microsoft Web Deploy
V2\msdepl y.exe" -verb:sync
-source:contentPath="C:\work\27f84e3eca3a 3d5\Output\BatchFiles"
-dest:contentPath="c:_DeployCommands",computer ame="192.168.1.14" Info: Using ID '326b55b4-602c-4cdf-ae5c-052e9d44b377' for connections
to the remote server. Warning: Retrying the sync because a socket
error (10054) occurred. Retrying operation 'Serialization' on object
MSDeploy.contentPath (sourcePath). Attempt 1 of 25. Info: Using ID
'a6e468ca-53b9-474b-8568-42dba196bd72' for connections to the remote
server. Error Code: ERROR_COULD_NOT_CONNECT_TO_REMOTESVC More
Information: Could not connect to the destination computer
("192.168.1.14" using the specified process ("Web Deployment Agent
Service") because the serve did not respond. Make sure that the
process ("Web Deployment Agent Service") i started on the destination
computer. Error: The remote server returned an error: (503) Server
Unavailable. Error count: 1.
Event Log Entry:
Application: MsDepSvc.exe Framework Version: v4.0.30319 Description:
The process was terminated due to an unhandled exception. Exception
Info: System.IO.FileNotFoundException Stack: at
Microsoft.Web.Deployment.Tracer.TraceError(Microsoft.Web.Deployment.DeploymentTraceSource,
System.String, System.Object[]) at
MSDepSvc.WDAgent.BeginProcessRequest(System.Net.HttpListenerContext)
at System.Net.LazyAsyncResult.Complete(IntPtr) at
System.Net.ListenerAsyncResult.IOCompleted(System.Net.ListenerAsyncResult,
UInt32, UInt32) at
System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32,
UInt32, System.Threading.NativeOverlapped*)
How can I diagnose this?
We ran into a similar issue. You're best bet is to decompile using ILSpy and add extra logging in every catch block and replace the exe on the client to see the exact error. In our scenario, we used on older version 7.1.1631.0 that works. There's a newer version 7.1.1762.0 that's caused the problem. The exe is copied from the client and not the server.
I had the exact same issue. It turned out to be a bug in Web Deploy 3.5 as described here: Could not find file or assembly Microsoft.Web.Deployment.Tracing with Web Deploy V3 using tempagent

Resources