locked
IIS deploy - Cannot load .cshtml RRS feed

  • Question

  • User-1027335337 posted

    Hi,

    I'm not sure this is the right place to post. However my problem... I have deployed my web app (asp.net mvc 5) to IIS but when I try to access the first page that doesn't load. What I get is an empty page. Opening the console show me:

    So I get the .js but not the .chtml (login in this example). The error in detail on login page request:

    However if i put directly the link in the browser (with the context 'RCM') I get the page (obviously css missing):

    Some advice to get all working?

    Note: the link called when I click Browse on my webApp in IIS:

    Monday, December 19, 2016 7:32 AM

All replies

  • User-460007017 posted

    Hi Mond0,

    Have you installed IIS feature completely? It looks a bit like your static content feature didn't be installed in turn windows feature on or off.

    You could also try the following script in web.config:

    <modules runAllManagedModulesForAllRequests="true" />

    If everything works fine Please check whether there is something wrong with your relative path(./ ~/) in A tag or something else. The outbound rule could be used to fix this problem.

    Best Regards,

    Yuk Ding

    Monday, December 19, 2016 9:56 AM
  • User-1027335337 posted

    Hi, 

    Thanks for your reply. My IIS:

    should be all installed (what it's necessary).

    For the modify on the web.config I had already tried it but nothing.

    Could be a problem about Asp.net routing on IIS (my versione is 8.5)? If can help I post what I'm doing about routing in my app:

    - app.js (angular routing) on client side:

            .state('loginPage', {
                url: '/login',
                views: {
                    'mainContent': {
                        controller: 'loginController',
                        templateUrl: 'Account/login'
                    }
                },
                authenticate: false
            })

    - Controller on server side:

            public ActionResult Login()
            {
                return View();
            }

    that should return the correct view.

    - RouteConfig.cs in the app_start:

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

    Monday, December 19, 2016 1:20 PM
  • User-460007017 posted

    Hi Mond0,

    I think the route should not be the problem. Does it works fine in visual studio? Did you publish your web application following this link:

    http://www.c-sharpcorner.com/UploadFile/4b0136/getting-started-with-iis-host-and-publish-in-mvc-5/

    Have you checked whether these file has been located in the correct place?

    You could try to grant permission for IUSR and change your application pool identity to local system in application pool->advanced setting->application pool identity.

    You could also try to enable allow 32-bit application in application pool->advanced setting->Enable 32-bit applications.

    Best Regards,

    Yuk Ding

    Tuesday, December 20, 2016 2:29 AM
  • User-1027335337 posted

    Hi,

    yes, in Visual Studio all work fine. 

    Deploying my web app I did exactly those points.

    I have also followed your others suggest but nothing work :-(

    Tuesday, December 20, 2016 11:30 AM
  • User-460007017 posted

    Hi Mond0,

    It's odd. I find that the IIS recognize .png file as text/html. It should be recognized as image/png.

    Please check the mime type in your IIS manager.

    Make sure the mime type configuration like this:

    <mimeMap fileExtension=".js" mimeType="application/javascript" />
     <mimeMap fileExtension=".png" mimeType="image/png" />

    Besides, please check staticfile module and staticfile handler has been configured correctly.

    Please make sure your static file feature has been installed correctly.

    Best Regards,

    Yuk Ding

    Wednesday, December 21, 2016 9:45 AM
  • User-1027335337 posted

    Hi,

    the mime type configuration is correct in my applicationHost file.

    However about checking static file module, handler, ect I didn't understand what I should do... For now I can see these are present:

    and

    Wednesday, December 21, 2016 11:02 AM
  • User-460007017 posted

    Hi Mond0,

    Have you check ISAPI filter? are there four filter registered in it?

    Best Regards,

    Yuk Ding

    Thursday, December 22, 2016 9:47 AM
  • User-1027335337 posted

    Hi,

    Update: I tried to deploy the simple basic project when you create a new ASP.NET Web Application on Visual Studio. It's working... So, I suppose I should check my project (I remember it's working on VS). But what's the difference? Just the fact I'm using AngularJS on the client side to route the pages. Is there something to configure? Or is it about types? 

    xhr and text/html are the types that I can't get. And: which is the reason .png files are mapped as text/html? Should they be as image/png, right?

    Thursday, December 22, 2016 10:00 AM
  • User-460007017 posted

    Hi Mond0,

    Now that the configuration in IIS works fine. Have you check the src attribute and make sure they are pointing to the correct location after being deployed.

    Best Regards,

    Yuk Ding

    Friday, December 23, 2016 7:51 AM
  • User-663892169 posted

    Please check MIME Type

    Friday, December 23, 2016 9:47 AM
  • User-1027335337 posted

    I'm not sure I got what you mean. Are you talking about src attr in the index file? 

    @Pravin Patel 

    I have already did it. Check my last image I have updated.

    Friday, December 23, 2016 11:40 AM
  • User-1027335337 posted

    Ok, I got the solution (or at least now I get the first page). I'm gonna fixing everything and if it's all works I will post the solution. It's embarrassing how stupid was that... 

    However... If I modify my app.js to:

    .state('loginPage', {
                url: '/login',
                views: {
                    'mainContent': {
                        controller: 'loginController',
                        templateUrl: window.location.pathname +  "/Account/login"
                    }
                },
                authenticate: false
            })

    all is working (I added 'window.location.pathname' to templateUrl). I should add that every time I call the server. But if I do that on VS all stop working (must remove '/'). Example:

    templateUrl: window.location.pathname +  "Account/login"

    is ok.

    Obviously I can't modify all my calls every time I need to update my project deployed. Is there a simpler way to accomplish that?

    Edit: 

    add

    $locationProvider.html5Mode(true);


     in the 'angular module'.config and

     <base href="/" /> 

    in the head of index.html

    Friday, December 23, 2016 1:26 PM
  • User-460007017 posted

    Hi Mond0,

    Thanks for sharing your experience.

    Best Regards,

    Yuk Ding

    Wednesday, December 28, 2016 7:50 AM