如何在 IIS 中发布 Blazor ASP.NET 应用程序? [英] How do i publish a Blazor ASP.NET App in IIS?

查看:73
本文介绍了如何在 IIS 中发布 Blazor ASP.NET 应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经构建了一个 Blazor-Server-App(ASP.NET Core 托管)并将其从 Visual Studio 发布到本地文件夹.效果很好.

现在我想在我的 Windows 服务器上发布它.它成功地运行了一些 ASP.NET Web API,因此基本上可以正常工作.它有一个自己的域.

我现在所做的是将本地文件夹复制到服务器并打开 IIS 管理器.我添加了一个网站并设置了文件夹的路径.

但是现在,当我单击应用程序设置"时,我收到有关 web.config 的错误,请参阅屏幕截图.

如果有任何关于为什么 Visual Studio 创建的 web.config 不适用于我的 IIS 的提示,我将不胜感激.

问候,提姆

解决方案

要在 iis 中发布 blazor 应用程序,首先确保您安装了以下 iis 功能:

  • .NET Core 托管包
  • ASP.NET Core 运行时

根据您的版本下载并安装运行时和托管包.

点击发布 > 开始 > 文件夹 > 选择文件夹路径并点击创建配置文件"按钮.

点击发布"按钮.

现在,打开 IIS.

右键单击站点">添加网站...".

设置所有详细信息,如站点名称"、物理路径"、IP 地址"等,然后单击确定"按钮.

完成!,现在右键单击浏览",您可以在浏览器中看到您的托管应用程序.

i have build a Blazor-Server-App (ASP.NET Core hosted) and published it from Visual Studio to a local folder. It worked fine.

Now i want to publish it on my windows server. It successfully runs some ASP.NET web APIs, so basically its working. It has an own domain.

What i did now is copying the local folder to the server and opening IIS Manager. I added a website and set the path to the folder.

But now, when i click on "Application Setting" i get an error regarding the web.config, see Screenshot.

I would appreciate any hints on why the web.config Visual Studio created does not work with my IIS.

Regards, Tim

解决方案

to publish blazor app in iis first make sure you installed below iis feature:

  • .NET Core hosting bundle
  • ASP.NET Core Runtime

Download and Install the Runtime and Hosting bundle as per your version.

https://dotnet.microsoft.com/download/dotnet-core/3.1

after installing hosting bundles do not forget to restart the machine. if you installed a hosting bundle bore installing iis you need to repair it.

now Open blazor application in Visual Studio, right-click on a project from solution explorer and select "Publish.." option.

Click on Publish > Start > Folder > choose a folder path and click on the "Create Profile" button.

Click on the "Publish" button.

Now, Open IIS.

Right Click on "SItes" > "Add Website…".

Set all details like "Site Name", "Physical path", "IP address" etc, and click on the "OK" button.

Done!, now right-click on Browse and you can see your hosted application inside the browser.

这篇关于如何在 IIS 中发布 Blazor ASP.NET 应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆