Error while running my MVC application

3

This is the error:

Linha 1:  
<%@ Application Codebehind="Global.asax.cs" Inherits="Util.MvcApplication" Language="C#" %>

I had created another project called Util and started to give this problem. What I did, I removed the project and continued. But in my Global.asax it looks like this:

<%@ Application Codebehind="Global.asax.cs" Inherits="Ruptura.MvcApplication" Language="C#" %>

How do I resolve this? This is the complete error:

Erro de Servidor no Aplicativo '/'.
Erro do Analisador
Descrição: Erro ao analisar um recurso necessário para atender esta solicitação.
Examine os detalhes específicos do erro de análise e modifique o arquivo de origem 
apropriadamente.     
Mensagem de Erro do Analisador: Não foi possível carregar o tipo 'Util.MvcApplication'.    
Erro de Origem:
    Linha 1:
    <%@ Application Codebehind="Global.asax.cs" Inherits="Util.MvcApplication" Language="C#" %>
Arquivo de Origem: /global.asax Linha: 1
Informações sobre a Versão: Microsoft .NET Framework Versão:4.0.30319;
    Versão do ASP.NET:4.0.30319.34009

It's the whole project, but put my View and Master

View :

@{
    ViewBag.Title = "Acao";
    Layout = "~/Views/Shared/_LayoutBase.cshtml";
}
<h2>Acao</h2>   
<div class="row">
    <div class="col-md-6">
        <div class="col-md-1">
            <label for="txtCnpjPdv">UF:</label>
        </div>
        <div class="col-md-6">
            <input type="text" class="form-control col-md-6" id="txtCnpjPdv" 
                placeholder="Digite o Cnpj" />
        </div>
    </div>
</div>

And the layout of it (Master):

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title></title>
    @Styles.Render("~/bundles/css")
    @Scripts.Render("~/bundles/modernizr")
    @Scripts.Render("~/Scripts/Util.js")
</head>
<body>
    <div class="navbar navbar-inverse navbar-fixed-top">
        <div class="container">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" 
                    data-target=".navbar-collapse">
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                @*@Html.ActionLink("Pedidos", "Index", "Home", null, new { 
                  @class = "navbar-brand" })*@
            </div>
            <div class="navbar-collapse collapse">
                <ul class="nav navbar-nav">
                </ul>
            </div>
        </div>
    </div>
    <div class="container body-content">
        @RenderBody()
        <hr />
        <footer>
            <p>&copy; @DateTime.Now.Year - Laboratórios Ltda</p>
        </footer>
    </div>
    @Scripts.Render("~/bundles/jquery")
    @Scripts.Render("~/bundles/bootstrap")
    @RenderSection("scripts", required: false)
</body>
</html>

It got worse! I saw that the Util project was in path and I deleted it once and now this error appears. It seems to me that somewhere in IISExpress it is being requested and there is nothing else of it, Useful :

HTTP Error 500.19 - Internal Server Error
A página solicitada não pode ser acessada porque os dados de configuração 
relacionados à página são inválidos.

Informações detalhadas do erro:
Módulo             IIS Web Core
Notificação        Desconhecido
Manipulador        Ainda não determinado
Código do erro     0x80070003
Erro de Configuração       Não é possível ler o arquivo de configuração
Arquivo de Configuração    \?\D:\Projetos ACHÉ\Ruptura\Util\web.config
URL solicitada             http://localhost:53130/
Caminho físico
Método de logon    Ainda não determinado
Usuário de logon   Ainda não determinado
Diretório de Rastreamento de Solicitação: 
    C:\Users\Paulo\Documents\IISExpress\TraceLogFiles\
Origem da Configuração:
   -1: 
    0: 

More information :

This error occurs when there is a problem reading the Web server or Web application configuration file. In some cases, event logs may contain more information about the cause of this error.

If you see the text "There is a% duplicate% section set", this error occurred because you are running a .NET Framework 3.5-based application in the .NET Framework 4 . If you are running WebMatrix , to resolve this issue, go to the Settings node to set the .NET Framework version / strong> as ".NET 2". You can also remove the extra sections of the web.config file.

    
asked by anonymous 15.08.2014 / 15:59

3 answers

1

By the way, your example shows that you are assigning a namespace to "Inherits" and you should assign the class that is within the Global.asax.cs

see my example:

in Global.asax

<%@ Application Codebehind="Global.asax.cs" Inherits="MyMvcApplication.MvcApplication" Language="C#" %>

in Global.asax.cs

namespace MyMvcApplication{
    public class MvcApplication : System.Web.HttpApplication {...}
}
    
18.09.2014 / 00:14
1

I was having the same problem. The extension file "csproj" ("FileName.csproj") was not creating the references of the new screens.

Then, I restarted the PC, in order to force the stop of all open program executions, I opened the .csproj file, and manually created the reference in the file and saved it as the IDE itself does.

EXAMPLE:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

  ...

 <Content Include="NomePastaDoArquivo\NomeDoArquivo.aspx" />

  ...

 <Compile Include="NomePastaDoArquivo\NomeDoArquivo.aspx.cs">
      <DependentUpon>NomeDoArquivo.aspx</DependentUpon>
      <SubType>ASPXCodeBehind</SubType>
    </Compile>
    <Compile Include="NomePastaDoArquivo\NomeDoArquivo.aspx.designer.cs">
      <DependentUpon>NomeDoArquivo.aspx</DependentUpon>
    </Compile>
    
28.07.2017 / 15:21
0

It is very simple to solve this problem: you need to rename the Inherits field because it is trying to inherit from a class that does not exist or has been renamed namespace , or is missing this DLL in your project:

<%@ Application Codebehind="Global.asax.cs" Inherits="Ruptura.MvcApplication" Language="C#" %>
    
06.11.2014 / 21:34