Why i have an error when deploy blazor to IIS - c#

I have an issue when i deploy blazor to iis:
I searched about this issue and found some ways like: add permission for folder publish,... but it doesn't work. I saw that 0x8007000d is a error about web.config file
this is my web.config
I try on other devices. It works.
So why my devices doesn't?. I use Visual Studio 2019, .Net 5.0 and deploy blazor to IIS on Windows 10.

Usually, this error indicates that the ASP.NET Core module is not installed on the server. Hosting ASP.NET Core applications on IIS requires the Microsoft ASP.NET Core module. You should confirm that the module is installed:
Install the .NET Core Hosting Bundle.

Related

Web Setup - VS2022 - Hosting Bundle Prerequisites

I want to install Hosting Bundle on relevant computer before the project is installed. However, it is not on this list.
How can I do this before installation?
I could not add it as a requirement since Hosting bundle is not in the list.
You can install.NET Core Hosting Bundle using the following link:
Thanks for downloading ASP.NET Core 7.0 Runtime (v7.0.2) - Windows Hosting Bundle Installer!
More information you can refer to this link: The .NET Core Hosting Bundle.

Running Vanilla ASP.NET-Core website on windows server get message "Did you mean to run dotnet SDK commands"

I'm trying to run the default vanilla ASP.NET core website from VS, on my windows server 2016 instance. But when I run it I get a HTTP 502.3 error
I enabled logging from the web config, the logging message I get back is
Did you mean to run dotnet SDK commands? Please install dotnet SDK from:
https://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409
I've install the windows hosting bundles
https://dotnet.microsoft.com/download/dotnet-core/2.2
https://dotnet.microsoft.com/download/dotnet-core/2.1
The CSProj is targeting the netcoreapp2.1 runtime
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>
The hosting bundle is for IIS proper, when deploying an already compiled ASP.NET Core app. In Visual Studio, you're running against IIS Express and the source code needs to be compiled to deploy it there. That requires the SDK; the runtime is not enough. Download the .NET Core SDK and you'll be fine.
The default publication was using 'portable' as a target runtime, which requires the SDK to be installed. Switching it to match your machine architecture, 'win-x64' in that case, enables it to run with simply the proper dotnet runtime installed.

asp.net core 2.1 target .Net Framework and run on IIS without hosting bundle

I have a .NET Core 2.1 application with target framework .Net Framework 4.6.1. I would like to host it on IIS but I don't want to install .net core hosting bundle. Is it possible to run this app on IIS without installing .Net Core Hosting Bundle? I tried running this page on local IIS but I get:
HTTP Error 500.19 - Internal Server Error The requested page cannot be
accessed because the related configuration data for the page is
invalid.
Most answers suggest installing .Net Core Hosting Bundle to fix this error, but since I am not allowed to install it on remote server I would like to know if there is any other way?
If you're targeting in your package references asp.net core 2.1 (as title says) then you're basically targeting Runtime Framework that you need to have installed on your machine.
Created a MVC application with ASP.NET Core 2.1 targeting .NET Framework and published the application to a folder.
Then, I managed to host the application in IIS with application pool with Integrated Pipeline and .NET CLR v4.0 as shown below:
Important: Next thing you need to ensure that Application pool identity user (IIS AppPool\{ApplicationPool Name} has Read and execute permissions on your publish folder.
If you check the web.config of your published app, you will notice AspNetCoreModule handler is referenced. This AspNetCoreModule is required to host the app in IIS as it act as a reverse proxy. So you need to install ASP.NET Core hosting bundle for installing this module.
https://learn.microsoft.com/en-us/aspnet/core/fundamentals/servers/aspnet-core-module?view=aspnetcore-2.1

What is the correct order of installation for running a DotNet Core web application on a local IIS server?

I run a local IIS Server with a DotNot Core 2.1 application deployed to it. I like to keep up to date with the latest security patches that are released monthly and I use the Core download page to do so.
My question is, what ALL do I need to install each time and in what order. I usually find a Framework installer and I chose the SDK just to make I have everything. Then I find a ASPNET.CORE installer and I run those in. Finally, I run the Web Hosting Bundle.
Am I doing too much? Do some of these items copy over the same assets? What is the correct proceedure?
If you need to host an asp.net core web app, follow the Host ASP.NET Core on Windows with IIS Guide.
In terms of installing things, follow the Install the .NET Core Hosting Bundle Section
The bundle will install 3 things:
.NET Core Runtime
.NET Core Library
ASP.NET Core Module (for IIS)

WebApi (.Net core 2.0) on aws ec2 (linux) deploying issue

I've built an webapi using .net core 2.0v on my windows system and trying to deploy it on the AWS linux ec2 (Centos v.). To deploy it on the linux machine i've used nginx server as tomcat doesn't support hosting of .net core 2.0 till date (which I read on blogs). Error I am getting which is below
"An assembly specified in the application dependencies manifest (WebApplication1.deps.json) was not found: package: 'Microsoft.ApplicationInsights.AspNetCore', version: '2.1.1' path: 'lib/netstandard1.6/Microsoft.ApplicationInsights.AspNetCore‌​.dll' This assembly was expected to be in the local runtime store as the application was published using the following target manifest files"
I know it's a simple dll issue by reading but what I've tried so far and observed is following
In step 1 when I tried to install .net core 2.0 sdk as per MSN blog it isn't allowing me to do so and giving error for few dependencies that it's break (so might be the root cause is that.)
In Step 2 I've checked the opt/dotnet/ dir, In this I am only finding 1.0.0-preview2-1-003177 folder. I am expecting dot net core 2.0 folder should also be there. as i've installed it with a shell script given by MSN. (might be full installation of packages is not yet happened)
In Step 3 I've tried to create a new WebApi Project from Aws terminal by the help of dotnet new -t command. but it's giving option for creating only web project. so I created one and in outcome I got a MVC Web Application rather then a WebApi also which was based on dot net 1.0 structure.
The same if I try on windows VisualStudio command prompt then it's giving me the option of creating WebApi project on terminal.
In Step 4 I've copied my project itself there on ec2 and tried to build it with the help of dotnet command but it's denying for any projects are available on the dir. (might be it's not recognizing the 2.0 application.)
In Step 5 I've tried to publish it with Self contained deployment feature of .net core, and I am finding this option might be helpful in such a scenario but again I am getting below error. In previous version of dot net we tend to solve these errors by writing specific version in web.config files but in .net 2.0 I don't know how to solve specially in self contained deployment.
Could not load file or assembly 'System.Runtime.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The located assembly's manifest definition does not match the assembly reference.
After doing all these should I treat like .net core 2 or 1 doesn't support webapi on linux environment till date or is there some workaround to do so. I've googled a bit but everyone is suggesting to depoly web application (1.0v & MVC application). Or Is there anything I am missing to do on AWS ec2 Linux side.
Note: Above WebApi I've published on IIS and it's working fine. same dll I've copied into linux and tried with.
In Conclusion I am just trying to deploy an WebService(.Net core 2.0) on AWS ec2 (linux, centos env.) so if anyone of you have done the same let me know above is the my analysis(Which may be wrong)and as per my understanding which is not that much on both of the platform(AWS, .Net core 2).
After trying Step 5, I am foreseeing that there might be some possibility.

Categories