I am setting up a razor components .net core 3.0 preview in IIS.
From VS 2019 via IIS Express site works fine, but when I am hosting it with IIS itself - front-end logic is not working (no click responses, etc) How can I host razor components in IIS?
As I am seeing from IIS Express panel - it is hosted on 2 ports while my app is working. (Probably, client and server side)
According to MS the app is included with the ASP.NET Core app in the published output.
My web.config
<?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="dotnet" arguments=".\BlazorApp.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
</system.webServer>
</location>
</configuration>
Looks like I am hosting only one side of razor components app, but should host both.
Related
I have created a demo Web Api in net6 using the Visual Studio 2022 template for that. The Web Api runs fine on my machine but when trying to host it in an Azure App Service it fails with the following error:
After some research I managed to have it working on Azure by changing the module "AspNetCoreModuleV2" to "AspNetCoreModule" in the web.config.
Here it is the web.config that gets deployed to Azure and it doesn't work:
<?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="dotnet" arguments=".\Web6Test.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
</system.webServer>
</location>
</configuration>
Is it possible to host the web api in Azure using the "AspNetCoreModuleV2" module?
There can be multiple reasons causing HTTP 500.30 error: ASP .Net core app failed to start like App Initialization, App Configuration and Key vault permission issues.
Thanks to 130nk3r5, I figured out how to find the root cause of the error:
Go to Azure Portal
Select App Services
Search and click on your App service
Go to development tools and open console.
Run the application through this console and then the real error that is causing the application not to load will be displayed.
You can refer to this SO thread for multiple solutions.
Hosting the web api can also be achieved by using AspNetCoreModuleV2 in the web.config.
I have reproduced the same by creating a .Net 6.0 Core web API project in Visual Studio.
Web.config:
<?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="dotnet" arguments=".\XXXXXX.dll" stdoutLogEnabled="false" stdoutLogFile="\\?\%home%\LogFiles\stdout" hostingModel="inprocess" />
</system.webServer>
</location>
</configuration>
<!--ProjectGuid: 09e5e23c-101e-41d1-bd27-60c6f5c08db0-->
Output when running the project locally:
Deployed the application to Azure App Service:
Output after hosting the application in Azure App Service:
Result:
I have a blazor app that is running fine on localhost.
Here's the steps I have taken to put my project live.
Setup new Windows Server on AWS.
Enabled IIS.
Installed ASP.NET Core Runtime Hosting Bundle.
Installed the URL Rewrite module.
Setup a SSL cert and DNS settings to point to IP.
Configured bindings to port 443 and picked the cert added path wwwroot/projectname
published my project using web deploy.
However, when navigating to my url I'm seeing 404 resource not found.
Only thing that is different is that the server added a web config to get it to run in IIS which looks like this.
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\App.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
</system.webServer>
</location>
</configuration>
<!--ProjectGuid: 8b081fc5-0f9d-4426-b9cf-90f4d30b5527-->
Anyone point me in the right direction as to what I should be looking out for or steps I may have missed as this is the first time I've attempted publishing a Blazor-Server application.
On my IIS, I have "AspNetCoreModuleV2" not "AspNetCoreModule" like this:
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\App.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
</system.webServer>
</location>
</configuration>
<!--ProjectGuid: 8b081fc5-0f9d-4426-b9cf-90f4d30b5527-->
See: Hosting A Blazor Visual Studio Project Directly In IIS
I have a website hosted in IIS using windows authentication. It works fine.
But if I host it as a web application unter a website, windows authentication doesn't work and the authentication window shows and then doesn't go away even if I put in the correct user name and password.
The SPN, delegation and IIS settings should be correct, otherwise the website won't work. Only if I deploy it as web application, windows authentication stoped working. Any idea?
Thanks for the reply, the sub status code is 401.1 and here the web.config file on the application level
<?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=".\DataService.exe" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</location>
<system.web>
<authentication mode="Windows" />
</system.web>
</configuration>
I finally found the solution.After enabling ASP.Net Impersonation on the web application, it works.Seems like, the web application needs impersonation to get the kerberos ticket from the website.
I've migrated a .NET Framework 4.6 WebApi to .NETCore 2.2 and am having trouble getting the IIS ApplicationInitialization module to call my endpoints on a startup/slot swap/scale out.
I added a Web.Config like:
<?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="dotnet" arguments=".\FR911.Api.Core.dll" stdoutLogEnabled="false" stdoutLogFile="\\?\%home%\LogFiles\stdout" hostingModel="inprocess" />
<applicationInitialization doAppInitAfterRestart="true">
<add initializationPage="api/Warmup>
<add initializationPage="/" />
</applicationInitialization>
</system.webServer>
</location>
</configuration>
But if I keep the default hosting model of "inprocess" my warmup never gets called. If I change to "outofprocess" hosting, my warmup does get called before the swap is completed.
I think the issue below is likely related:
https://github.com/aspnet/AspNetCore/issues/8057
I'm not looking to just manually ping or otherwise hit my endpoint because I want the existing feature in the module that IIS is Azure won't actually swap the endpoints until the warmup requests have finished (thus initing EFCore etc.)
Has anyone had any luck getting this to work with the inprocess hosting model?
I'm getting an HTTP 502.5 error when trying to run my ASP.NET core 2.0 web app from IIS.
I've installed the .NET Core Windows Server Hosting Bundle and checked all my IIS settings as per this document https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/index?tabs=aspnetcore2x
The web.config looks like this.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\OscarWeb.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</configuration>
The Windows event log produces the following errors.
It is IIS v6.2 running on Windows Server 2012 R2. The web application was built using ASP.NET Core 2.0.
When I run dotnet from the commandline as follows there are no errors:
dotnet oscarweb.dll
The first thing you have to do in this scenario is to create the logs folder if it is missing and check the stdout logs generated.
It can be several different things but from personal experience the most common issue i had was IIS not having enough permissions to run it. In IIS you can configure the Identity used in Advanced Settings. If it is using ApplicationPoolIdentity then change it to LocalSystem and see if it works. The logs in the stdtout file however will give you the answer.
The solution to this problem (in my case at least) was to reboot the web server. After installing the .NET Core Windows Server Hosting Bundle you need to reboot the server for them to be registered correctly.
Thanks to Chris Pratt (first comment underneath my question) for suggesting the answer :)
Not sure if your webconfig is complete. I believe aspnetcore tag needs to have the ASPNETCORE_ENVIRONMENT environment variable set as well.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\OscarWeb.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" >
<environmentVariables>
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="YourRuntimeEnv" />
</environmentVariables>
</aspNetCore>
</system.webServer>
</configuration>