0

I have an ASP.NET MVC application and it fails to start. The incident started to happen after the update of the Visual Studio. .NET version of the application is 4.6.2.

Here is the content of the web.config file:

<?xml version="1.0"?>
<configuration>
    <configSections>
        <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
        <section name="oracle.manageddataaccess.client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=4.122.18.3, Culture=neutral, PublicKeyToken=public_key_token"/>
    </configSections>
    <appSettings configSource="Development.config"/>
    <system.web>
        <!-- <customErrors mode="Off" /> -->
        <customErrors mode="On" defaultRedirect="mycustompage.htm"/>

        <compilation debug="true" targetFramework="4.6.2"/>
        <!--<httpRuntime targetFramework="4.5.2" />-->
        <!--<machineKey validationKey="machine_key" decryptionKey="description_key" validation="validation1" decryption="decryption1" ></machineKey>-->
        <globalization enableClientBasedCulture="true" requestEncoding="utf-8" responseEncoding="utf-8" culture="tr-TR" uiCulture="tr-TR" fileEncoding="utf-8"/>

        <httpModules>
            <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web"/>
        </httpModules>
        <authentication mode="Forms">
            <forms loginUrl="Account/Login"/>
        </authentication>
    </system.web>
    <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <dependentAssembly>
                <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
                <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0"/>
            </dependentAssembly>
            <dependentAssembly>
                <publisherPolicy apply="no"/>
                <assemblyIdentity name="Oracle.ManagedDataAccess" publicKeyToken="public_key_token" culture="neutral"/>
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
                <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234"/>
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
                <bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0"/>
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
                <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0"/>
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="Microsoft.Owin.Security.OAuth" publicKeyToken="31bf3856ad364e35"/>
                <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0"/>
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="Microsoft.Owin.Security.Cookies" publicKeyToken="31bf3856ad364e35"/>
                <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0"/>
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
                <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0"/>
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35"/>
                <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35"/>
                <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
            </dependentAssembly>
        </assemblyBinding>
    </runtime>
    <system.webServer>
        <staticContent>
            <clientCache cacheControlCustom="public" cacheControlMode="UseMaxAge" cacheControlMaxAge="365.00:00:00"/>
            <remove fileExtension=".woff"/>
            <remove fileExtension=".woff2"/>
            <mimeMap fileExtension=".woff" mimeType="application/x-font-woff"/>
            <mimeMap fileExtension=".woff2" mimeType="application/font-woff2"/>
        </staticContent>
        <security>
            <requestFiltering>
                <requestLimits maxAllowedContentLength="1524288000"/>
            </requestFiltering>
        </security>
        <validation validateIntegratedModeConfiguration="false"/>
        <modules>
            <remove name="ApplicationInsightsWebTracking"/>
            <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" preCondition="managedHandler"/>
        </modules>
    </system.webServer>
    <entityFramework>
        <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
            <parameters>
                <parameter value="mssqllocaldb"/>
            </parameters>
        </defaultConnectionFactory>
        <providers>
            <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
            <provider invariantName="Oracle.ManagedDataAccess.Client" type="Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices, Oracle.ManagedDataAccess.EntityFramework, Version=6.122.18.3, Culture=neutral, PublicKeyToken=public_key_token"/>
        </providers>
    </entityFramework>
    <system.data>
        <DbProviderFactories>
            <remove invariant="Oracle.ManagedDataAccess.Client"/>
            <add name="ODP.NET, Managed Driver" invariant="Oracle.ManagedDataAccess.Client" description="Oracle Data Provider for .NET, Managed Driver" type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=4.122.18.3, Culture=neutral, PublicKeyToken=public_key_token"/>
        </DbProviderFactories>
    </system.data>
    <oracle.manageddataaccess.client>
        <version number="*">
            <dataSources>
                <dataSource alias="STUDYINTURKEY" descriptor="descriptor)))) "/>
            </dataSources>
        </version>
    </oracle.manageddataaccess.client>
    <connectionStrings>
        <add name="Context" providerName="Oracle.ManagedDataAccess.Client" connectionString="connectionString"/>
    </connectionStrings>
    <system.codedom>
        <compilers>
            <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701"/>
            <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+"/>
        </compilers>
    </system.codedom>
</configuration>

Here is the Global.asax.cs:

using WebApplication.Bll.UserLogBll;
using WebApplication.Dal.Concrete.EnetityFramework.Repository;

namespace WebApplication.Mvc
{
    public class MvcApplication : System.Web.HttpApplication
    {
        IVisitorLogService _visitorLogService = new VisitorLogManager();
        
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            RouteConfig.RegisterRoutes(RouteTable.Routes); 
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            AntiForgeryConfig.SuppressXFrameOptionsHeader = true;
        }

        protected void Session_End(object sender, EventArgs e)
        {
            if (this.Session.SessionID == "LogStart")
            {
                // User ziyaret bitiş
            }
        }

        protected void Session_Start(object sender, EventArgs e)
        {
            if (this.Session.SessionID == "LogStart")
            {
                // User ziyaret başlangıç
            }
        }

        protected void Application_EndRequest()
        {
        }

        protected void Application_BeginRequest()
        {
        }
    }
}

When I clicked the "Run" button at the upper section of Visual Studio, I get this error page:

error page

What went wrong? Thanks in advance.

5
  • .NET 4.6.x is obsolete - you need to update it to .NET 4.8. You won't find any machines/servers running .NET 4.6.x today: if it runs 4.6.1 then it can be updated to 4.8 - and Windows Update will have done that for you... years ago. Commented Aug 23, 2024 at 6:40
  • I will update this as soon as possible, but now this issue is out of question for now. Commented Aug 23, 2024 at 6:49
  • 1
    The reason for the error is given in the HTTP 404 error page under the heading "Detailed error information" - have you read it? If not, why not? If you have read it, then what part of it don't you understand? Commented Aug 23, 2024 at 6:52
  • @tahasozgen please check my answer, I edited multiple times, and it is ready now. Hope that helps. Commented Aug 23, 2024 at 7:26
  • You don't see the exact error, since there is a misconfiguration as mentioned in the answer below. First thing you need to see exact error. Then you may understand what is the problem. Commented Aug 23, 2024 at 7:40

1 Answer 1

0

Looks like this is not the original error. There is another error happened and you are redirecting error to a static html file (.htm extension.), which is not a good practice. Uncomment following to see original error.

<!-- <customErrors mode="Off" /> -->

Another option you may redirect to custom error view that displays error instead of static html or remove this defaultRedirect="mycustompage.htm" redirection to handle error by yourself in the global.asax.cs. You may check this question to see some examples about general error handling: ASP.NET MVC Custom Error Handling Application_Error Global.asax?

Another thing, in your web config uncomment this line and update the version to the one that you are using which is "4.6.2".

<!--<httpRuntime targetFramework="4.5.2" />-->

Last thing that I recently notice from the screenshot. Your IIS configuration uses IIS Web Core module. This can be the source of the problem since this application is not an ASP.NET Core application.

Since I do not have the project, these are all I can say. Hope this helps.

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

Comments

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.