相关疑难解决方法(0)

如何更改ASP.Net WebAPI应用程序的根路径?

我正在尝试创建一个结合ASP.NET WebAPI和Yeoman Angluarjs生成器的单页Web应用程序.目前我的项目结构如下所示

|-- yeomanAngularApp |-- app |-- dist |-- scripts |-- index.html |-- etc... |-- WebApiApp |-- App_Start |-- bin |-- Content |-- Controllers |-- Models |-- WebApiApp.csproj |-- dist |-- scripts |-- index.html

当我想构建应用程序分发时,我将dist文件夹复制yeomanAngularAppWebApiApp替换该dist文件夹中.

现在这很容易做到.我真正想要做的是告诉WebApiApp不要使用WebApiApp\作为项目的根,但使用WebApiApp\dist.这意味着不是去http://localhost/dist/index.html,我可以去,http://localhost/index.html即使index.html是在dist文件夹中.除此之外,我还希望我的控制器的WebAPI路由也能很好地发挥作用.

我一直在寻找,我似乎无法找到答案.我能想到的最好的就是使用URL重写,这对我来说感觉不对.

asp.net asp.net-web-api

18
推荐指数
1
解决办法
3320
查看次数

标签 统计

asp.net ×1

asp.net-web-api ×1