Setting app a separate Web API project and ASP.NET app

佐手、 提交于 2019-11-30 10:21:48

As it turned out it's pretty simple. All I had to do is configure these both projects to share the same port on the local IIS: So for the native JS/HTML (my second project) I use:

And the second project (WEB-API project):

That is it! Now the js can consume the Web-Api!

You just need a single project: ASP.NET Web API. I would put the index.html in the root and javascript files under scripts or js folder.

Normally static content such as js and html can be served directly by IIS in your ASP.NET Web API project. You need to make sure you add them to ignore rules in the startup:

RouteTable.Routes.IgnoreRoute("*.js");
RouteTable.Routes.IgnoreRoute("*.html");
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!