IIs Error: Application Codebehind=“Global.asax.cs” Inherits=“nadeem.MvcApplication”

前端 未结 22 3195
灰色年华
灰色年华 2021-02-19 15:16

I am trying to deploy my web project and I keep getting this error:

Line 1: <%@ Application Codebehind=“Global.asax.cs” Inherits=“nadeem.MvcApplication” Langu         


        
相关标签:
22条回答
  • 2021-02-19 16:15

    Solved, just renamed the Global.asax or delete it fixed the problem :/

    Other known related bugs I found on the web:

    1. Global.asax.cs: must inherit from HttpApplication -> public class MvcApplication : HttpApplication
    2. Project output must be the bin folder and not Bin/Debug, etc.
    3. Iss application pool is not in the correct .net version.
    0 讨论(0)
  • 2021-02-19 16:17

    I faced similar error, tried all the suggestions above, but did not resolve. what worked for me is this:

    Right-click your Global.asax file and click View Markup. You will see the attribute Inherits="nadeem.MvcApplication". This means that your Global.asax file is trying to inherit from the type nadeem.MvcApplication.

    Now double click your Global.asax file and see what the class name specified in your Global.asax.cs file is. It should look something like this:

    namespace nadeem
    {
    
    public class MvcApplication: System.Web.HttpApplication
        {
        ....
    

    But if it doesn't look like above, you will receive that error, The value in the Inherits attribute of your Global.asax file must match a type that is derived from System.Web.HttpApplication.

    Check below link for more info:

    Parser Error: Server Error in '/' Application

    0 讨论(0)
  • 2021-02-19 16:18

    Right Click > Open Folder in File Explorer

    If you are in the directory, find Global.asax not the Global.asax.cs

    Right click on Global.asax file then find Open with

    Change Inherits="ProjectNameThatHasError.MvcApplication" to Inherits="YourNamespaceNow.MvcApplication"

    You can open it in Notepad, Visual Studio any version, anyways you'll be editing text.

    0 讨论(0)
  • 2021-02-19 16:20

    Nothing above worked for me. Everything was correct.

    Close the Visual Studio and reopen again. This fixed the issue in my case.

    The problem could have been caused by different versions of visual studio. I have Visual studio 2017 and 2019. I had opened the project on both the versions simultaneously. This might have created different set of vs files.

    Close any instance of the Visual Studio and open again.

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