2015-10-15 18 views
0

也許這是以前回答,但我找不到它。如果是這種情況,一個好的鏈接將會很好。asp net start angular app

我正在ASP.NET應用程序頂部開發一個角度應用程序。我通過一項寧靜的服務與他們溝通。問題是,當我從Visual Studio運行我的應用程序(使用IIS)它進入網址

http://localhost:51061/ 

正如我不能進入這個頁面我得到禁止錯誤403。我想,當我推在Visual Studio中運行我的應用程序中啓動。

http.//localhost:51061/AngularApp/ 

的Global.asax.cs

namespace WebApi { 
     public class WebApiApplication : System.Web.HttpApplication 
     { 
      protected void Application_Start() 
      {   
       GlobalConfiguration.Configure(WebApiConfig.Register);  
      } 
     } 
    } 

WebApiConfig.cs

namespace WebApiPrC 
{ 
    public static class WebApiConfig 
    { 
     public static void Register(HttpConfiguration config) 
     { 
      config.MapHttpAttributeRoutes(); 

      config.Routes.MapHttpRoute(
       name: "DefaultApi", 
       routeTemplate: "backend/api/{controller}/{id}", 
       defaults: new { id = RouteParameter.Optional } 
      ); 
     } 
    } 
} 

謝謝

回答

1

你有沒有看「」項目>屬性>網絡>開始行動「的部分?

但是,您可以指定你想要的應用程序來啓動,例如‘當前頁’,‘Specfic頁’和」啓動URL 「等我想你想進入的網址‘開始的網址’框中

enter image description here

+0

謝謝你解決了我的問題。這是一個簡單的修復:) – acostela

0

Webapi是一個服務器和客戶端之間資源傳輸的框架(僅用於數據),以及用於建立Angul的視圖路由的框架路由選擇。 在這種情況下,應用angularApp角路由是有用,如:

AngularApp.config(['$routeProvider', 
    function($routeProvider) { 
    $routeProvider. 
     when('/', { 
    templateUrl: 'xxx.html', 
    controller: 'xxxcontrollername' 
    }). 
    otherwise({ 
    redirectTo: '/login.html' 
    }); 

}]);

希望所以它幫助你。

+0

我有我的角度應用的角度路由我的問題是如何告訴Visual Studio中運行的http:// localhost:51061/AngularApp /作爲默認路由 – acostela