I am getting a blank page while deploying MVC application on IIS

后端 未结 13 1059
一生所求
一生所求 2020-12-06 00:27

I am currently deploying my application built using RC of MVC ASP.NET on the production server which is showing nothing now. The routes in my global.ascx are typical i.e. <

相关标签:
13条回答
  • 2020-12-06 01:03

    You will also get a blank page when you have error handling setup in your global.asax and something generic is wrong (like an assembly that could not be found).

    When you disable it in the global.asax, you can see the server error. Don't forget to enable it again after fixing those initial bugs.

    protected void Application_Error(object sender, EventArgs e)
    {
        Exception exception = Server.GetLastError();
        RouteData routeData = new RouteData();
        routeData.Values.Add("controller", "ErrorController");
        routeData.Values.Add("action", "HandleTheError");
        routeData.Values.Add("error", exception);
    
        Response.Clear();
        Server.ClearError();
    
        IController errorController = new ErrorController();
        errorController.Execute(new RequestContext(
            new HttpContextWrapper(Context), routeData));
    }
    
    0 讨论(0)
  • If it's the production server that is having the problem, it is probably the role permissions. You need to make sure that all of the folders and files your application is using allow reading (and in some cases writing if your using logs) to the role identity that IIS is using.

    Usually the identity IIS is using is in Web Site Properties -> Directory Security -> Edit (Authentication and access control). If you don't want to allow any computer on your network to access the website then you should probably turn off "Enable anonymous access". If you do want to allow this though, this will be the identity you need to give access to in your webapp folders and files. Otherwise you may need to give access to the role which contains the user identities you want to have access.

    0 讨论(0)
  • 2020-12-06 01:08

    I solved the issue, the major issue was the different versions of MVC framework. Production Server was having MVC Beta while i have installed MVC RC1. So as soon as i installed the RC1 on the server as well as run the mvc extension registeration scripts, everything worked Thanks for your help guys

    0 讨论(0)
  • 2020-12-06 01:08

    This means you have an Exception thrown in your MVC application but you likely have a class in your MVC that's capturing, filtering, and hiding those exceptions. Those exceptions are still thrown but you cant see whats causing them. MVC still reroutes the page request but returns nothing because of the hidden exceptions. You cant stop the problem until you see the exceptions being thrown. You cant see the exceptions in the web page until you turn off MVC's exception handing filters.

    One thing that might be preventing you from seeing the exceptions is a GlobalFilterCollection called via an MVC filter in the global.asax when the website first loads. You can normally find these calls in the Global.asax file. That file generally calls the HttpApplication object when the website first loads and its events. In its events it then loads in the default MVC routes developers add, but can also load filters that process site-wide exception handling. Developers often stuff Exception handling via filters in the global.asax thinking they are intelligently handling exceptions and issues from the user, but which is a mistake. If you find a filter in there just comment them out. Suddenly all your errors will appear in your HTML page again once you do.

    You can then troubleshoot the problem! Good luck!

    0 讨论(0)
  • 2020-12-06 01:08

    This was also happening to me when:

    1) I added a CompressAttribute to add Gzip when the browser accepts it.

    response.AppendHeader("Content-Encoding", "gzip");
                        response.Filter = new GZipStream(response.Filter, CompressionMode.Compress);
    

    2) I was modifying the output HTML to change the displayed phone number:

    response.Filter = new OutputHtmlReplacer(response.Filter, phoneNumber);
    

    where OutputHtmlReplacer is a class that inherits from MemoryStream

    So, the solution was:

    1) Verify the headers and check if we are applying compression.

    2) If so, then the new OutputHtmlReplacer response filter has to be wrapped by the GzipStream.

    0 讨论(0)
  • 2020-12-06 01:11

    As another possible solution:

    I had not deployed for a month or so, but had updated my Visual Studio by a few minor releases. A incompatibility crept in between VS Base and some of my Nuget packages. Updated my packages, made sure to clean (and delete bin/obj - even though it did not initially solve the problem) and then redeployed. Worked thereafter.

    0 讨论(0)
提交回复
热议问题