Reputation: 73
To be more specific, I have an existing scaffolded application with a default home page. I added a new cshtml page (with viewmodel and controller). The application started, went to the default page, I navigated to my new page and it was fine. Made a change to some html. Then I got this error..that this new page needs to be in its own managed process pool. Undid the change. Error still. So far I have followed answers to similar issues such as:
I have ANCMV2, have checked that this module is in use. (VS 2019 up to date with IIS development pack and all the asp net core packs, web packs etc..)
So the question: What could make a new cshtml page require its own thread pool? The controller code is essentially identical to the default HomeController code (return("view"); etc...
My start up code is as follows (Ive read this could be a cause):
public void ConfigureServices(IServiceCollection services)
{
services.AddControllersWithViews().AddRazorRuntimeCompilation();
services.AddBundles(options =>
{
options.AppendVersion = true;
});
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Home/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
});
}
Upvotes: 0
Views: 122
Reputation: 77
I am not sure that this is similar to my situation or not. but once earlier I got the same error you got and here is what I did.
Upvotes: 0
Reputation: 2252
Right-click on your project file in solution explorer and click on Edit Project File
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
</PropertyGroup>
also, change AspNetCoreHostingModel value from InProcess to OutProcess and re-run your application.
Upvotes: 0
Reputation: 73
So it turns out we used to use IISExpress! There was some remnants there in a launchSettings.json file. Deleted this (and rebooted the machine) and no problems anymore! (Hopefully some people find this helpful)
Upvotes: 1