.NET CORE 3.1 on Azure Web Sites: 500.37 ANCM Failed to Start Within Startup Time Limit - azure

I have .NET Core 3.1 API which is deployed in Azure web application service. I had trouble running the application in Azure because of the error 500.37 ANCM Failed to Start Within Startup Time Limit. I managed to solve this issue by increasing startupTimeLimit in web.config (as you can see below).
But Now, when I'm running 2 instances in Azure web app service. One of the instances works just fine but the other one still has the same error.
Any ideas on how How to set startupTimeLimit for multiple instances in IIS?
web.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<!-- To customize the asp.net core module uncomment and edit the following section.
For more info see https://go.microsoft.com/fwlink/?linkid=838655 -->
<system.webServer>
<httpProtocol>
<customHeaders>
<remove name="X-Powered-By" />
</customHeaders>
</httpProtocol>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\Clients.Api.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" startupTimeLimit="180" hostingModel="inprocess" >
</aspNetCore>
</system.webServer>
</configuration>
Edit:
I used azure web app Scale out (App Service plan) to increase the running instance to 2.

We solved this solution by increasing the startupTimeLimit to 300
<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<location>
<system.webServer>
<aspNetCore xdt:Transform="SetAttributes(startupTimeLimit)" startupTimeLimit="300">
</aspNetCore>
</system.webServer>
</location>
</configuration>

Finally I was able to fix this error.
It is a configuration error (.net core configuration). Azure App Services need an additional configuration of the project when it is in .net core 3.1.
The solution is:
In project file (asp.net or web api project) (*.proj) you have to place the following line just below TargetFramework:
<AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
Final *.proj file would be something like this :
<Project Sdk="Microsoft.NET.Sdk.Web"> <PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
<UserSecretsId>my-secrets-go-here</UserSecretsId>
<Version>1.1.0.0</Version>
<Authors>me</Authors>
<Company>TheCompany</Company>
<Platforms>AnyCPU;x64</Platforms>
</PropertyGroup>
...
</Project>
And that's it. After adding those changes and uploading a new version on your Azure App Service the application is going to be executed without errors (unless there's something else related to your code).
I was able to replicate this error by executing my project directly on IIS from my local, when you do that VS opens the web browser but the web page is never loaded.

Started getting this error when running my .net core 3.1 application on production. The error occurs immediately after updating the application. However, for me, running iisreset on cmd was enough to solve the error.

if application work perfect on development machine and this error exist on your production server that is not connected to internet
check event log and find if you have any error like this:
Failed extract of third-party root list from auto update cab at
you need just update server certificates
with Online option : connect server to internet
with Offline option: follow this guide

Related

How do I deploy Blazor WebAssembly Core Hosted Self-Contained App to IIS [duplicate]

This question already has an answer here:
asp.net core web api published in IIS after moved to different IIS server pc gives error 500.19 (0x8007000d)
(1 answer)
Closed 2 years ago.
I have developed a Blazor WebAssembly App that will be used on a Server running Windows 2012 on our Intranet. This is targeting .Net 5.0 Core Hosted and Self-Contained. I need to deploy to IIS 8.5 and have some questions.
When I add the website in IIS, do I point to the root deploy directory with the executable and web.config?
Is there anything else I need to do so that IIS will find the index file in the wwwroot sub-directory?
Is is appropriate to put the deploy directory for this app directly under inetpub?
The publish task created a rather large BlaorDebugProxy directory. This is for release so I don't understand why this was created. Is there a way to prevent this from happening?
I want to access the app using ServerName\AppName. If I create the site with 'AppName' for the host name, will that work or is there something else I need to do?
When I try to browse to the site from IIS, I get a 500.19 'The requested page cannot be accessed because the related configuration data for the page is invalid.' I have not made changes to the file as it was created by the publish process. It is:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath=".\AppName.Server.exe" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
</system.webServer>
</location>
</configuration>
<!--ProjectGuid: 60862cf1-bea8-48f4-8ae9-270f2f537927-->
Any ideas why this is not working?
PLEASE NOTE that this is using the SELF-CONTAINED model.
Also, I have made sure that the directory has granted full permissions to the App Pool Identity for this App.
The answer below and the supposed duplicate all refer to installing the framework. However, I thought that the whole point of the self-contained model is that it does not rely on an installed framework.
I have searched extensively and see many references that touch on these issues but nothing that says specifically how to get IIS (especially an older version) to host the self-contained model. The Microsoft pages talk about advantages and disadvantages and how to create the files but no details about how to host them or the other questions I listed above.
Has anyone done this successfully who can provide some guidance?
Thanks !
Firstly, please ensure that the Asp.net Core IIS Hosting Bundle installer has been installed on the server.
https://dotnet.microsoft.com/download/dotnet/5.0
Besides, the identity under where your web application runs in IIS should have full access to the root folder of your website. Try to grant the IUSR account full control to that physical path.
Last, please refer to the below link to hosting Core-based web application in IIS.
https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/?view=aspnetcore-3.1
Feel free to let me know if the problem still exists.

Deployed Web Core API: Response status code does not indicate success: 404 (Not Found).

I have deployed a new application that contains a Web Project which communicates with a Web Core API.
I have used this link as a reference to set it up;
https://learn.microsoft.com/en-us/aspnet/core/publishing/iis
IIS has been set up for a while on this test server, so some the steps did not need to be repeated.
In IIS if I browse the Web API is launches as follows.
But if I do likewise for the web project that uses it, I am getting this error:
Response status code does not indicate success: 404 (Not Found) for a simple get call to the Web API.
What should I be considering to fix this?
Multiple possibilities I see
You just browsed to the root url and you do not have any default page setup in IIS . To see the Web API,browse to the webapi url you have specified in your route.config file.
Default route will be like this based on your routing.Could you browse to
http://testweb.sherrygreengrp.com/api/<controller>
You do not have the Windows Server Hosting Bundle
Install the .NET Core Windows Server Hosting bundle on the hosting
system. The bundle will install the .NET Core Runtime, .NET Core
Library, and the ASP.NET Core Module. The module creates the
reverse-proxy between IIS and the Kestrel server. Note: If the system
doesn't have an Internet connection, obtain and install the Microsoft
Visual C++ 2015 Redistributable before installing the .NET Core
Windows Server Hosting bundle
ASP.NET CORE Module correctly configured .Do you have this setting in your web.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="%LAUNCHER_PATH%"
arguments="%LAUNCHER_ARGS%"
stdoutLogEnabled="false"
stdoutLogFile=".\logs\stdout" />
</system.webServer>
</configuration>
I found that the URI I needed on the deployment server needed to have the name of my application, whilst in development this was not needed. Once I made that correction it worked fine.

iis 7 + http custom handler error: could not load file or assembly The system cannot find the file specified

Windows vista 32 bit - C# - .NET 4 - sqlite - IIS 7
I'm building a small project that contains is a custom HTTP handler where an user can request a XML file and the project will generate the file and send it to the user. It should be flexible enough to send something else too like e.g. json.
Everything was going well until I had to deploy the handler. I've created a library (dll) file which contains the logic for serving of the requested information. I've open IIS manager and I've created a virtual directory to the debug bin file (later on i made it an application. it did not make a difference).
I've followed countless examples and tutorials like these ones:
I started with this one: http://support.microsoft.com/kb/308001
http://msdn.microsoft.com/en-us/library/bb515343.aspx
msdn.microsoft.com/en-us/library/46c5ddfy.aspx
But with no luck. As you could have read I'm not using any asp.net website even though I do have a web.config that I've added to the bin folder and it looks like this:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<httpErrors errorMode="Detailed" />
<asp scriptErrorSentToBrowser="true" />
<directoryBrowse enabled="false" />
<handlers accessPolicy="Read, Script, Execute">
<add name="LigoManagedHandler" path="*" verb="*" type="Ligo.Service, Ligo" resourceType="Unspecified" preCondition="integratedMode" />
</handlers>
</system.webServer>
</configuration>
When I try to run handler in the browser get the following error:
Could not load file or assembly 'Ligo' or one of its dependencies. The system cannot find the file specified.
Exception Details: System.IO.FileNotFoundException: Could not load file or assembly 'Ligo' or one of its dependencies. The system cannot find the file specified.
I have tried so many possible combination in IIS manager to get it working ('httphandlers', 'classic mode' and so on ...) but i'm truly stuck. The information I've found on the internet is not helping much.
What am I doing wrong or missing to make it work?
Something in this rant triggered an idea, an I stumbled on the answer.
The line in all those tutorials that say put type="ClassName, AssemblyName" into the Handlers section in Web.Config are plain WRONG.
All I did was change this to type="AssemblyName.ClassName" and everything started working, in both a Web Site Project and a Web Application Project that I had created.
I'm running IIS 7.5 in integrated mode so YMMV.
Craig
I figure it out. I had to make a asp.net website project and add my dll as reference to this project.
I read this thread that provided this information which is not clear on the internet.
http://forums.asp.net/t/1088861.aspx/1?What+causes+the+quot+Could+not+load+type+quot+problem+
It should state that it is not possible to make the httphandler without a aspnet website project. or am i mistaken? the example on the internet are incorrect! or provide too little information.
I know, this is an old thread. However, I've been looking for an answer for a few days without finding a clear one. So, in case anyone comes across similar scenario.
You can create custom Http Handler as a stand-alone Class Library project and use it in IIS.
On IIS Add new Application with ASP4 Integrated mode. Place your compiled DLL into bin folder (this is what i was missing all along). Seems obvious that it should be there; took some time to figure this out. :)
web.config:
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.webServer>
<handlers>
<add verb="*" path="*.ogg" name="test" type="Namespace.Classname"/>
</handlers>
</system.webServer>
</configuration>
Hope this helps.
Cheers.

ASP.NET Web App using the wrong (2.0) CLR version (instead of 4.0)

I just deployed an asp.net web app I have been working on to a new dev machine. It's a 4.0 project converted from 3.5. For some reason, I get the following error when I try to hit the site via my IIS website under the Default Website:
Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive.
It lists this as being a config error on the ASP.NET error page:
<compilation debug="true" targetFramework="4.0"/>
However, I notice that at the bottom of the error page, the version information indicates that it is using version 2 instead of version 4. Anyone have ideas about how to fix this?
I have made sure that my default website usese a .net 4 / integrated app pool and i cycled iis after this change was made. Still not luck. Here is my entire web.config file:
<?xml version="1.0"?>
<configuration>
<appSettings/>
<connectionStrings>
<add name="EventMasterConnectionString" connectionString="Data Source=localhost;Initial Catalog=BashBidder;Integrated Security=True" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="true" targetFramework="4.0">
</compilation>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Windows"/>
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/></system.web>
<!--
The system.webServer section is required for running ASP.NET AJAX under Internet
Information Services 7.0. It is not necessary for previous version of IIS.
-->
</configuration>
Thanks for the help!
You have to configure your application pool so it uses version 4.0 of the framework.
This procedure explains how to do it on IIS 7, and that one on IIS 6.

CruiseControl.Net on Windows Server 2003 x64

I'm having an issue with CruiseControl.net where the web dashboard just won't work in IIS. I have tried switching ASP.Net between 64 and 32 bit modes and reinstalling cruise control, but nothing seems to work. Has anyone else had issues with CruiseControl.Net on 64 bit platforms?
Cheers,
Jamie
[Edit]
Thought I should clarify, I am getting a 404 error when I try access the website. I am using the correct address because it asks for authentication. The .aspx handler is working because I don't see the default.aspx page from the ccnet directory.
[Edit2]
I am using the default web.config that comes with ccnet, but here it is:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<!-- Change this if (for example) you want to keep your dashboard config file under source control -->
<add key="DashboardConfigLocation" value="dashboard.config" />
</appSettings>
<system.web>
<httpHandlers>
<!-- Yes, we are overriding .aspx - don't delete this! We are using .aspx since we know it is already bound to ASP.NET. In future we might use a
different extension so that people can add their own ASP.NET pages if they want to, but we should make sure in that case to change how
URLs are created -->
<add verb="*" path="*.aspx" type="ThoughtWorks.CruiseControl.WebDashboard.MVC.ASPNET.HttpHandler,ThoughtWorks.CruiseControl.WebDashboard"/>
<add verb="*" path="*.xml" type="ThoughtWorks.CruiseControl.WebDashboard.MVC.ASPNET.HttpHandler,ThoughtWorks.CruiseControl.WebDashboard"/>
</httpHandlers>
<compilation defaultLanguage="c#" debug="true" />
<customErrors mode="RemoteOnly" />
<authentication mode="Windows" />
<!-- APPLICATION-LEVEL TRACE LOGGING
Application-level tracing enables trace log output for every page within an application.
Set trace enabled="true" to enable application trace logging. If pageOutput="true", the
trace information will be displayed at the bottom of each page. Otherwise, you can view the
application trace log by browsing the "trace.axd" page from your web application
root.
-->
<trace
enabled="false"
requestLimit="10"
pageOutput="true"
traceMode="SortByTime"
localOnly="true"
/>
<sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1;user id=sa;password="
cookieless="false" timeout="20" />
<globalization requestEncoding="utf-8" responseEncoding="utf-8" />
</system.web>
It seems I needed to enable Web Service Extensions for ASP.Net. I'm still not getting an ASP.Net tab in the cruise control website properties, but it is working.
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727> or C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727> for 64 bit
Type aspnet_regiis.exe – i
ASP.NET will register itself and show up in Web Service Extensions
Clarify a bit, does the web-dashboard function incorrectly? Does it not show up at all?
The webdashboard uses Nvelocity, not ASP.NET WebForms, so you have to register a custom HTTPHandler in the Web.config for it to work.
<add verb="*" path="*.aspx" type="ThoughtWorks.CruiseControl.WebDashboard.MVC.ASPNET.HttpHandler,ThoughtWorks.CruiseControl.WebDashboard"/>
Post up your web.config.
Since you just want to know whether it works... it does.
I'm running it on a 64-bit Windows Server 2008 without a problem.
So now we've established it works, perhaps you can describe your issue in more detail?
Could not comment, I wanted to add this to the aswer to Adam:
I had to use this command in CMD for Win2008 x64
"C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\aspnet_regiis.exe" -s "W3SVC/1/ROOT/ccnet"

Resources