且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

ASP.NET WEB API 2在本地,不适用于生产Web服务器

更新时间:2023-02-15 19:31:03

注意:我创造了在这种情况下的子域API,但一切都为code的API是创建时的持平。

"Note: I created a subdomain 'api' in this case, but everything for the code for the API is unchanged from when it was created."

以上您的评论是可疑的,你应该公布在根目录下你的WEB API应用程序。就像如果 http://example.com 指向myexample中文件夹中,然后应用程序应该在myexample中文件夹中公布。
之后,你就可以访问你的API使用 http://example.com/api/ {}控制器/ {}行动

Above comment of your's is suspicious, you should publish your WEB API application in the root directory. Like if http://example.com is pointing to "MyExample" folder, then application should be published on "MyExample" folder. After that you will be able access your api with http://example.com/api/{controller}/{action}