none
WebApiConfig.Register(GlobalConfiguration.Configuration) RRS feed

  • Pergunta

  • Olá alguém pode orientar para solução do erro abaixo?

    Erro de Servidor no Aplicativo '/'.

    Falha no método 'System.Web.Http.HttpConfiguration..ctor(System.Web.Http.HttpRouteCollection)' ao tentar acessar o método 'System.Web.Http.HttpConfiguration.DefaultFormatters()'.

    Descrição: Ocorreu uma exceção sem tratamento durante a execução da atual solicitação da Web. Examine o rastreamento de pilha para obter mais informações sobre o erro e onde foi originado no código. 

    Detalhes da Exceção: System.MethodAccessException: Falha no método 'System.Web.Http.HttpConfiguration..ctor(System.Web.Http.HttpRouteCollection)' ao tentar acessar o método 'System.Web.Http.HttpConfiguration.DefaultFormatters()'.

    Erro de Origem: 
    Linha 19:             AreaRegistration.RegisterAllAreas();
    Linha 20: 
    Linha 21:             WebApiConfig.Register(GlobalConfiguration.Configuration);
    Linha 22:             FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
    Linha 23:             RouteConfig.RegisterRoutes(RouteTable.Routes);
    quarta-feira, 19 de julho de 2017 11:09

Respostas

Todas as Respostas

  • abaixo packages.config:

    <?xml version="1.0" encoding="utf-8"?>
    <packages>
      <package id="bootstrap" version="3.1.1" targetFramework="net40" />
      <package id="Bootstrap.v3.Datetimepicker" version="4.7.14" targetFramework="net40" />
      <package id="Bootstrap.v3.Datetimepicker.CSS" version="4.7.14.1" targetFramework="net40" />
      <package id="EntityFramework" version="6.1.3" targetFramework="net45" />
      <package id="iTextSharp" version="4.1.2" targetFramework="net40" />
      <package id="jQuery" version="2.1.1" targetFramework="net40" />
      <package id="jQuery.jqGrid" version="4.4.4" targetFramework="net40" />
      <package id="jQuery.UI.Combined" version="1.10.4" targetFramework="net40" />
      <package id="jQuery.Validation" version="1.12.0" targetFramework="net40" />
      <package id="jQueryUIHelpers.Mvc4" version="2.2.0" targetFramework="net40" />
      <package id="knockoutjs" version="2.2.0" targetFramework="net40" />
      <package id="Less.js" version="1.5.1" targetFramework="net40" />
      <package id="Microsoft.AspNet.Mvc" version="4.0.30506.0" targetFramework="net40" />
      <package id="Microsoft.AspNet.Mvc.FixedDisplayModes" version="1.0.0" targetFramework="net40" />
      <package id="Microsoft.AspNet.Providers.Core" version="1.2" targetFramework="net40" />
      <package id="Microsoft.AspNet.Providers.LocalDB" version="1.1" targetFramework="net40" />
      <package id="Microsoft.AspNet.Razor" version="2.0.30506.0" targetFramework="net40" />
      <package id="Microsoft.AspNet.Web.Optimization" version="1.0.0" targetFramework="net40" />
      <package id="Microsoft.AspNet.WebApi" version="4.0.30506.0" targetFramework="net40" />
      <package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net45" />
      <package id="Microsoft.AspNet.WebApi.Core" version="4.0.30506.0" targetFramework="net40" />
      <package id="Microsoft.AspNet.WebApi.WebHost" version="4.0.30506.0" targetFramework="net40" />
      <package id="Microsoft.AspNet.WebPages" version="2.0.30506.0" targetFramework="net40" />
      <package id="Microsoft.Bcl" version="1.1.10" targetFramework="net45" />
      <package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="net45" />
      <package id="Microsoft.Build.Framework" version="14.3.0" targetFramework="net45" />
      <package id="Microsoft.jQuery.Unobtrusive.Ajax" version="3.1.2" targetFramework="net40" />
      <package id="Microsoft.jQuery.Unobtrusive.Validation" version="3.1.2" targetFramework="net40" />
      <package id="Microsoft.Net.Http" version="2.2.29" targetFramework="net45" />
      <package id="Microsoft.Report.Viewer" version="11.0.0.0" targetFramework="net40" />
      <package id="Microsoft.ReportViewer.2015" version="12.0.2.2402" targetFramework="net40" />
      <package id="Microsoft.ReportViewer.2015.Runtime" version="12.0.2.2402" targetFramework="net40" />
      <package id="Microsoft.ReportViewer.Common.v12" version="12.0.0.1" targetFramework="net45" />
      <package id="Microsoft.SqlServer.Types" version="11.0.2" targetFramework="net40" />
      <package id="Microsoft.SqlServer.Types.Unofficial" version="12.0.2000.8" targetFramework="net45" />
      <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net40" />
      <package id="Modernizr" version="2.6.2" targetFramework="net40" />
      <package id="Moment.js" version="2.9.0" targetFramework="net40" />
      <package id="MvcJqGrid" version="1.0.13" targetFramework="net40" />
      <package id="Newtonsoft.Json" version="9.0.1" targetFramework="net45" />
      <package id="PagedList" version="1.17.0.0" targetFramework="net40" />
      <package id="PagedList.Mvc" version="4.5.0.0" targetFramework="net40" />
      <package id="RazorPDF" version="1.0.0" targetFramework="net45" />
      <package id="Trirand.jqGrid" version="4.4.4" targetFramework="net40" />
      <package id="Twitter.Bootstrap.Less" version="3.0.3" targetFramework="net40" />
      <package id="WebGrease" version="1.3.0" targetFramework="net40" />
    </packages>

    quarta-feira, 19 de julho de 2017 11:13
  • Resolvido:

    Reinstalado

    Microsoft.AspNet.WebApi.WebHost

    • Marcado como Resposta Wilson Boris quarta-feira, 19 de julho de 2017 22:02
    quarta-feira, 19 de julho de 2017 22:02