已发布的Blazor WebAssembly应用程序将API调用重定向到页面,而不是API控制器

发布于 2025-02-10 17:17:16 字数 370 浏览 0 评论 0原文

我有一个带有客户端和服务器项目的Blazor WASM应用程序。客户端通过使用api-call获取是从服务器中获取的数据。但是,当我将应用程序发布到Azure时,它不起作用。

在Visual Studio中运行: https:// localhost:{number}/api/project/getall返回预期的JSON。

发表于Azure: https:// {website} .azurewebsites.net/api/project/getall返回index.html的内容,

我认为这与路由有关,但我无法弄清楚。

注意:当我在Release-Modus(以Azure中的数据库访问数据库)中运行该项目时,它可以按预期工作。

感谢您的帮助!

I have a Blazor Wasm application with a Client and a Server project. The Client gets is data from the Server by using an api-call. However, when I publish the application to Azure it doesnt work.

Running in Visual Studio:
https://localhost:{number}/api/Project/GetAll returns the expected json.

Published in Azure:
https://{website}.azurewebsites.net/api/Project/GetAll returns the content of the index.html

I think it has something to do with routing but I cannot figure it out.

Note: when I run the project in Release-modus (which accesses the database in Azure) it works as expected.

Thanks for any help!

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文