.NET 6 BLAZOR服务器端挂在身份验证的用户上

发布于 2025-02-13 11:48:45 字数 594 浏览 0 评论 0原文

我正在开发一个大风服务器端,该服务器端从API获取所有数据;与SQL Server的唯一连接是使用单个用户帐户使用身份身份验证。

它在开发环境中可以正常运行,但是当部署到IIS时,它在尝试访问托管在同一服务器上的数据库时会悬挂。

我无法获得确切的错误,因为发出警告说:

交换开发环境显示详细信息 关于发生的错误。开发环境不应该 可以启用用于部署的应用程序。它可以导致显示 从例外到最终用户的敏感信息。对于本地 调试,通过设置 Aspnetcore_environment环境变量可开发和 重新启动应用程序。

我尝试设置生产aspnetcore_environment to 开发 - 不幸的是,不幸的是,不幸的是,不幸的是, - - 不幸的是,不是特定于服务器端的jnet。警告。

IIS是否需要除用户名和密码以外的其他权限才能从Blazor Server Side应用程序访问SQL Server数据库?

如何将aspnetcore_environment临时设置为.NET 6 Blazor Server Side应用程序的“开发”?

I am developing a Blazor server side which gets all data from an API; the only connection to a SQL Server is to use Identity authentication with individual user accounts.

It works ok in the development environment but when deployed to IIS, it hangs when trying to access the database, which is hosted on the same server.

I can't get the exact error since the warning thrown says:

Swapping to the Development environment displays detailed information
about the error that occurred. The Development environment shouldn't
be enabled for deployed applications. It can result in displaying
sensitive information from exceptions to end users. For local
debugging, enable the Development environment by setting the
ASPNETCORE_ENVIRONMENT environment variable to Development and
restarting the app.

Anything I tried to set production ASPNETCORE_ENVIRONMENT to development - from other posts unfortunately not specific to server side Blazor over .NET 6 - does not display the real exception and I keep getting that warning.

Does IIS need any further permissions beyond username and password to access the SQL Server database from a Blazor server side app?

How can I temporarily set ASPNETCORE_ENVIRONMENT to "development" for production environment on a .NET 6 Blazor Server side app?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

层林尽染 2025-02-20 11:48:48

要暂时显示生产中的错误,您可以将此行添加到主项目文件的< propertyGroup>中:

<EnvironmentName>Development</EnvironmentName>

但是请注意,您的生产环境然后将在AppSettings.development中拾取定义的设置。 JSON文件。

希望这有帮助!

To temporarily display errors in production, you can add this line to the <PropertyGroup> of your main project file:

<EnvironmentName>Development</EnvironmentName>

But be aware that your production environment will then pick up settings defined in the appsettings.Development.json file.

Hope this helps!

超可爱的懒熊 2025-02-20 11:48:47

最终发现该问题是通过子域SQL从同一家服务器访问SQL。[mydomain] .com作为dataSource。
环境可以从Internet访问它,但是为了在本地访问它

开发人员 是否有任何解决暂时显示生产错误的解决方案

Finally discovered the problem was Blazor trying to access SQL from same server with a subdomain sql.[mydomain].com as Datasource.
Developer environment could access it from the internet, but in order to access it locally I've had to add an entry 127.0.0.1 sql.[mydomain].com to C:\Windows\System32\drivers\etc\host

Anyway if anybody has any solution to temporarily display errors on production it will be apreciated

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文