Reputation: 5123
From this morning without any changes to the code of the project, a very simple Web API, one controller and 3 methods, with Swagger, it doesn't start anymore and I get the error:
HTTP Error 500.35 - ANCM Multiple In-Process Applications in same Process
Event viewer report the most useless message:
IIS Express AspNetCore Module V2: Failed to start application '/LM/W3SVC/2/ROOT/docs', ErrorCode '0x80004005'.
Restarted the system several times.
I'm using Visual Studio 2019, the application successfully compile and a few minutes ago it was working fine. No new software has been installed, no packages added. Tried also clean and rebuild.
I've just modified the comment of a method. Obviously I've tried also to restore the previous comment but I get always the same message.
What can I do?
Is net core still too unstable to be used professionally?
UPDATE
The same code launched from the same version of Visual Studio but in another PC runs properly.
UPDATE 2
Below the code of the application:
startup.cs
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.FileProviders;
using Microsoft.Extensions.Hosting;
using Microsoft.OpenApi.Models;
using System;
using System.IO;
using System.Reflection;
namespace WFP_GeoAPIs
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
public void ConfigureServices(IServiceCollection services)
{
services.AddControllers();
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo() { Title = "Geographic APIs", Version = "v1.0.0" });
var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.XML";
var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
c.IncludeXmlComments(xmlPath);
});
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseStaticFiles(new StaticFileOptions
{
FileProvider = new PhysicalFileProvider(
Path.Combine(Directory.GetCurrentDirectory(), "swagger-ui")),
RequestPath = "/swagger-ui"
});
app.UseHttpsRedirection();
app.UseRouting();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
app.UseSwagger();
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "GeoAPIs Ver 1.0.0");
c.RoutePrefix = "docs";
c.InjectStylesheet("/swagger-ui/custom.css");
});
}
}
}
Here is the launchsettings.json:
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:51319",
"sslPort": 44345
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "docs",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"WFP_GeoAPIs": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "docs",
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
but coping the project on another PC with the same Visual Studio version works fine, so it looks like the is a configuration bug in the .NET Core or VIsual Studio property...
Upvotes: 130
Views: 97294
Reputation: 167
According to the ASP.NET Core, Out-of-process hosting with IIS and ASP.NET Core article:
1) Go to the Startup.cs
. In the ConfigureServices
:
services.Configure<IISOptions>(options =>
{
options.ForwardClientCertificate = false;
});
2) Go to the: "Properties" folder > "PublishProfiles" folder > "Web Deploy.pubxml" file. To configure an app for out-of-process hosting, set the value of the <AspNetCoreHostingModel>
property to OutOfProcess
:
<PropertyGroup>
<AllowUntrustedCertificate>True</AllowUntrustedCertificate>
<AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
</PropertyGroup>
3) Publish your project again.
Upvotes: 2
Reputation: 2538
If the hosted application is .Net Core 3.1, use the new App Pool.
According to the asp.net core, In-process hosting model article shows:
Sharing an app pool among apps isn't supported. Use one app pool per app.
The idea is you have to use one app pool for one application. Please do not share one app pool with multiple applications.
Upvotes: 0
Reputation: 1
In my case it was because of Dependency Injection (.Net Core 3.1).
I had used ILogger
but missed to provide the Type ILogger<type> logger
in the constructor injection. I had just provided ILogger logger
resulting in the "HTTP Error 500.30 - ANCM In-Process Start Failure" shown while running the API.
Tried looking through Event Viewer logs as per suggestions but in vain :(.
Finally looked at VS Output window for clues and found this
"Exception thrown: 'System.AggregateException' in Microsoft.Extensions.DependencyInjection.dll"
I recollected the recent changes and went ahead and provided the type in the constructor and it worked fine.
Upvotes: 0
Reputation: 4838
ASP.Net Core 6, after publishing edit the web.config
file, and change hostingModel="InProcess"
to hostingModel="OutofProcess"
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore .... hostingModel="OutOfProcess" stdoutLogFile=".\logs\stdout" />
</system.webServer>
I've left the modules
as V2, and it worked.
Upvotes: 0
Reputation: 414
In my case it got fixed just switching Application pool to .NET v2.0
Upvotes: 0
Reputation: 22662
It's currently a bug in VS2019 - (Nov 4 '2019)
1.) Close your solution
2.) Delete applicationhost.config
in folder .vs
or delete the whole .vs
folder.
The .vs
folder is a hidden folder and is next to your solution file usually.
3.) Restart your solution again
Upvotes: 235
Reputation: 8750
If you see this error (HTTP Error 500.35 - Multiple In-Process Applications in same Process ASP.NET Core 3) after deploying your application to a server (in house or 3rd party hosting provider), it could be that the relevant module is not installed on the host server.
In my case, it didn't have AspNetCoreModuleV2
and I had to update the web.config from:
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
to:
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
Alternatively, this can also be set in the .csproj file as follow:
<PropertyGroup>
<AspNetCoreModuleName>AspNetCoreModule</AspNetCoreModuleName>
</PropertyGroup>
Upvotes: 1
Reputation: 59
The Most Easy And Reliable think which worked for me is , just simply put a simple index.html in main application , and treat every application in your solution as subapplications.
Upvotes: 0
Reputation: 204
I fixed the issue by deleting V2 in web.config file generated after publishing the solution.
<handlers>
<add name="aspNetCore" path="*" verb="*"
modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
instead of
<handlers>
<add name="aspNetCore" path="*" verb="*"
modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
Upvotes: 17
Reputation: 111
I had the same problem.
Add this line in .csproj file in Tag:
<AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel
>
Although it is the 500.30 error it also fixed the 500.35 problem.
HTTP Error 500.30 - ANCM In-Process Start Failure
I hope help you.
Best regards.
Upvotes: 5
Reputation: 6007
In .csproj
file, set:
<PropertyGroup>
...
<AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
</PropertyGroup>
Allow host the same pool
Upvotes: 3
Reputation: 17542
I got the same error when I did the following:
Problem:
Since both my sites are under "Default Web Site" they are both using DefaultAppPool, which is the cause of this error. The same error occurs when the sites are not under "Default Web Site" but use the same app pool.
Solution:
As mentioned in the docs,
To fix this error, run apps in separate IIS application pools.
for me this problem was resolved when I started using separate app pools for each site.
Upvotes: 43
Reputation: 5123
Thanks to @Lex Li he has given me the solution.
The issue was in the applicationhost.config, the metabase file containing all the settings for the IISExpress launch by Visual Studio to run your web application.
For Visual Studio 2019, this file is located in
$(solutionDir)\.vs\{projectName}\config\applicationhost.config
For other version check this post: Where is the IIS Express configuration / metabase file found?
under the section I had the following:
<sites>
<site name="WebSite1" id="1" serverAutoStart="true">
<application path="/">
<virtualDirectory path="/" physicalPath="%IIS_SITES_HOME%\WebSite1" />
</application>
<bindings>
<binding protocol="http" bindingInformation=":8080:localhost" />
</bindings>
</site>
<site name="MyProjectName" id="2">
<application path="/" applicationPool="MyProjectName AppPool">
<virtualDirectory path="/" physicalPath="E:\Projects\MyProjectName" />
</application>
<application path="/docs" applicationPool="docs AppPool">
<virtualDirectory path="/" physicalPath="E:\Projects\MyProjectName" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:59386:localhost" />
<binding protocol="https" bindingInformation="*:44345:localhost" />
</bindings>
</site>
<siteDefaults>
<!-- To enable logging, please change the below attribute "enabled" to "true" -->
<logFile logFormat="W3C" directory="%AppData%\Microsoft\IISExpressLogs" enabled="false" />
<traceFailedRequestsLogging directory="%AppData%\Microsoft" enabled="false" maxLogFileSizeKB="1024" />
</siteDefaults>
<applicationDefaults applicationPool="Clr4IntegratedAppPool" />
<virtualDirectoryDefaults allowSubDirConfig="true" />
</sites>
Where there are some strange setting defined by
<application path="/docs" applicationPool="docs AppPool">
<virtualDirectory path="/" physicalPath="E:\Projects\MyProjectName" />
</application>
that has been certainly added when I've tried to set as start folder the /docs path.
Commenting out this setting and another one at the end of the file related to this path has solved the issue.
Upvotes: 58