未发现入口点例外



我已经安装了vs2012 (11.0.50727.1)
我打开了一个新的 MVC4 with .NET 4.5 解决方案,
我创建了一个简单的HomeController,并且由于我想在本地启动它,因此我收到了一个非常奇怪的错误:
如何解决?这是什么错误,为什么会发生??

预先感谢您的任何帮助。

    Server Error in '/' Application.
Entry point was not found.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.EntryPointNotFoundException: Entry point was not found.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:

[EntryPointNotFoundException: Entry point was not found.]
   System.Web.Mvc.IDependencyResolver.GetService(Type serviceType) +0
   System.Web.Mvc.DependencyResolverExtensions.GetService(IDependencyResolver resolver) +56
   System.Web.Mvc.SingleServiceResolver`1.GetValueFromResolver() +44
   System.Lazy`1.CreateValue() +180
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +22
   System.Lazy`1.get_Value() +10749357
   System.Web.Mvc.SingleServiceResolver`1.get_Current() +15
   System.Web.Mvc.MvcRouteHandler.GetSessionStateBehavior(RequestContext requestContext) +121
   System.Web.Mvc.MvcRouteHandler.GetHttpHandler(RequestContext requestContext) +33
   System.Web.Mvc.MvcRouteHandler.System.Web.Routing.IRouteHandler.GetHttpHandler(RequestContext requestContext) +10
   System.Web.Routing.UrlRoutingModule.PostResolveRequestCache(HttpContextBase context) +9709656
   System.Web.Routing.UrlRoutingModule.OnApplicationPostResolveRequestCache(Object sender, EventArgs e) +82
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +136
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.17929 

我已将一个项目从MVC3+.NET4转换为MVC4+.NET4.5,并且在调用控制器的操作时会收到异常Entry point was not found

我的解决方案是在Web.config中插入一个装配绑定重定向,以指向MVC 4组件:

  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>

我不知道问题的确切原因,也许还有一些仍然引用mvc3的第三方库。

当您将项目从MVC3切换到MVC4时出现相同的错误,而忘记将System.Web.WebPages.Razor, Version=1.0.0.0更改为web.config中的System.Web.WebPages.Razor, Version=2.0.0.0

旧帖子,但是如果您在MVC woes(system.mvc.dll更新)之前遇到它,例如.0.1)

<dependentAssembly>
    <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.0.1" />
  </dependentAssembly> 

如果在WebAPI控制器中捕获此错误 - 您需要修复绑定 System.Web.http

的版本
<dependentAssembly>
    <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
</dependentAssembly>

您还应检查解决方案中的所有项目是否参考了DLL的最新版本,并且不同的子项目没有使用不一致的版本。

尽管运行了nuget卸载,安装和更新我发现测试项目正在引用system.net.http

的旧版本

如果使用.NET 4.5并将活页夹添加到ModelBinders.Binders收集.NET 4.0库,则还将获得此类错误。

您在global.asax.cs?

中是否有类似的东西
private static void InitializeDependencyInjectionContainer(HttpConfiguration config)
{
    container = new UnityContainer();

    container.RegisterType<Site.Web.Data.IDatabaseFactory, Site.Web.Data.DatabaseFactory>();
    container.RegisterType<Site.Web.Data.Interfaces.IUnitOfWork, Site.Web.Data.UnitOfWork>();
    container.RegisterType<Site.Web.Data.Interfaces.IUserRepository, Site.Web.Data.Repositories.UserRepository>();
    container.RegisterType<Site.Web.Data.Interfaces.ISiteRepository, Site.Web.Data.Repositories.SiteRepository>();

从堆栈跟踪中,您发布的System.Web.Mvc.IDependencyResolver.GetService(Type serviceType) +0建议您的一个(或更多)依赖项无法解决。

您可以尝试评论其中一个或多个,并尝试缩小哪个无法解决的方法。

旧帖子,但只是为了添加到任何看起来的人

这似乎是一个捕获的错误。当我的web.config使用外部部分时,我明白了,该部分被排除在Visual Studio项目中,即使用此

<sessionState configSource="SystemWeb.config" />

尝试一下..在Visual Studio中转到包装管理员控制台并输入:

update-package

我面对这个问题并通过
解决1.卸载包装microsoft.aspnet.mvc(我需要卸载其他内容,然后才能成功卸载aspnet.mvc)
2.安装包装Microsoft.aspnet.mvc -version 4.0.20710
3.重建和部署

在我的情况下不是特定于MVC,但刚刚开始遇到此错误:

"/'应用程序中的服务器错误"。

找不到入口点。

描述:执行当前Web请求期间发生了一个未经治疗的异常。请查看堆栈跟踪以获取有关错误及其在代码中起源的更多信息。

异常详细信息:system.entrypointNotFoundException:找不到入口点。

源错误:

在执行当前Web请求期间生成了一个未经治疗的例外。可以使用下面的异常堆栈跟踪来识别有关异常的原点和位置的信息。

堆栈跟踪:

[entrypointNotFoundException:找不到入口点。]

...

system.web.ui.page.processrequestmain(boolean Incluctagesbeforeasyncpoint,boolean incluce incluctages afterAsyncpoint) 8008

版本信息:Microsoft .NET框架版本:4.0.30319;ASP.NET版本:4.6.1055.0

是什么原因是我从Visual Studio中发布给Web服务器文件夹并被选为预编译应用程序(使用.NET 4.5项目),允许预编译的网站可更新设置设置。

我的问题可能是该网站在IIS上的.NET 4.0运行,而在发布操作期间,将预编译的版本放在bin文件夹中为4.5。当我删除" bin"时网站的文件夹再次运行良好。

只需更新" nuget"

相关内容

最新更新