1

I have searched everything under the sun! It is driving me insane. I have set up a MVC 4.0 application on IIS 8.5 on windows 8.1 and getting 404 error when routing. Below is my routing defined:

routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{action}",
                defaults: new { action = RouteParameter.Optional }
            );

            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
            );

i' ve added: runAllManagedModulesForAllRequests="true" in web.config but no use! i want controller/view to work e.g

<a href ='Controller/View'>Home</a>

the routing via

<a href='@Url.Action("View", "Home")'>Home</a>

this works but my angular module loading/routing fails! My angular is set up as below:

.config(function ($stateProvider, $urlRouterProvider) {
    $stateProvider
       .state(
        "main", {
            url: "/",
            views: {
                '': { templateUrl: '/Partials/MainTemp.html' },
                //Menu 
                'columnOne@main': {
                    templateUrl: '/Partials/Menu.html',
                    controller: 'menuCtrl'
                },
                //Page
                'columnTwo@main': {
                    templateUrl: '/Partials/MainPage.html',
                    controller: 'mainCtrl'
                }
            }

        })

Everything works fine in debug mode. Am i missing something very basic!

3
  • Is your MVC project configured to serve up .html files? stackoverflow.com/questions/17949460/… Commented Jun 8, 2015 at 3:02
  • i have one home page -> controller/view href url does n ot work but @url() works - it points to a view (.cshml> which has angular setup - the .html are not in views folder but under scripts > module > partials. Following are my handlers in web.config: Commented Jun 8, 2015 at 3:41
  • <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" /> <remove name="BlockViewHandler"/> <add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" /> </handlers> @user1 Commented Jun 8, 2015 at 3:43

0

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.