Plesk 上的 Angular 和 ASP .Net Web Api
我使用 Angular 和 .net Framework 5.0 创建了一个网站。我在 Plesk 上发布了 Angular,网站可以访问并且工作正常(没有后端),但我在发布 .net Framework 应用程序并将其与 Angular 连接时遇到问题。
- 当我发布.net时,Angular如何了解.net框架应用程序?我是否需要更改正在执行 get/post 方法的角度服务中的 url?
AuthService.ts 示例:
private _loginUrl = "https://localhost:44365/api/Users/authenticate";
私人_checkLogin = “https://localhost:44365/api/Users/userByUsername”;
私有_logoutUrl =“https://localhost:44365/api/Users/logout”
我观看了有关发布 .asp net 的教程(右键单击解决方案 -> 发布,然后将其复制到文件管理器中),但是当我托管时我收到错误 404。当然,我没有任何 .html 页面或视图。仅 .net api 中的模型和控制器。
如何在 .net 中定义连接字符串以绑定到我在 Plesk 中创建的在线 SQL 数据库,以及如何设置我的 Angular,以便它可以了解我创建的 .net api 并与之通信?
I created a website with angular and .net framework 5.0. I published angular on Plesk and website is accessible and it's working fine (without backend) , but I'am having problem to publish .net framework app and connect it with angular.
- How angular can know about .net framework app when I publish .net? Do i need to change my url's in angular services who are doing get/ post methods?
AuthService.ts example :
private _loginUrl = "https://localhost:44365/api/Users/authenticate";
private _checkLogin =
"https://localhost:44365/api/Users/userByUsername";private _logoutUrl = "https://localhost:44365/api/Users/logout"
I watched tutorials about publishing .asp net ( Right Click Solution -> Publish , then copying it in file manager) , but when I host it I'am getting Error 404. Of coure, I don't have any .html pages or Views. Only models and controllers in .net api.
How to define connection strings in .net to bind on my online sql database which i created in Plesk and how to setup my angular so it can know and communicate with .net api I created?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
localhost 仅在您的计算机上可用,当您发布应用程序时,您必须根据发布 asp.net 项目的域更改基本 url,如下所示
更改为
这样,如果您是,只需将 baseUrl 更改为 localHost发展
localhost is only available on your computer and when you publish your application you have to change the base url as shown below according to the domain on which the asp.net project is published
change to
That way, just change the baseUrl to localHost if you are developing