0

Maybe this is answered before but I couldn't find it. If this is the case a good link will be great.

I'm developing an angular application in top of an ASP.NET app. I communicate them through a restful service. The problem is when I run from visual studio my app (using IIS) it goes to url

http://localhost:51061/

As I can't get into this page i get an error 403 forbidden. I want that when I push run inside visual studio my app start in.

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 }
            );
        }
    }
}

Thank you

2 Answers 2

1

Have you looked at ""Project > Properties > Web > Start Action" section?

You can specify however you want the app to start, e.g. "Current Page", "Specfic page" and "Start URL" etc. I guess you want to enter the url to "Start URL" box.

enter image description here

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you that solved my problem. It was an easy fix :)
0

Webapi is a framework for resource transmission between server and client (data only) and for views routing you have set up Angular routing . In this case,angularApp application angular routing is useful like :

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

}]);

Hope So its help you.

1 Comment

I have my angular routing in the angular application. My question is how to tell visual studio to run localhost:51061/AngularApp as default route

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.