2016-05-12 36 views
4

我的網站從Visual Studio運行良好,但只要我部署到IIS我得到以下錯誤。System.EntryPointNotFoundException MVC5

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.DependencyResolver.InnerSetResolver(IDependencyResolver resolver) +289 
    Rabobank.Risk.LicwidWorkflow.UI.UnityConfig.RegisterComponents() +125 
    Rabobank.Risk.LicwidWorkflow.UI.MvcApplication.Application_Start() +30 

[HttpException (0x80004005): Entry point was not found.] 
    System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +12602733 
    System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +175 
    System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +304 
    System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +404 
    System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +475 

[HttpException (0x80004005): Entry point was not found.] 
    System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +12619780 
    System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159 
    System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +12459397 

我不知道爲什麼會發生這種情況。任何指針將不勝感激

+0

檢查您的web.config文件並檢查程序集引用及其版本與引用版本。 – dcreight

+0

請確保您具有支持您正在使用的MVC版本的正確版本的Unity - 例如,如果您使用的是MVC5,請確保您具有Nuget的Unity.MVC5包。 –

回答

1

這通常發生在使用依賴注入時。 如果您有多個引用對方的項目,請確保它們的目標是相同的框架或兼容的框架。同時檢查所有package.config文件,並確保每個xml行的targetFramework與您的項目目標框架相匹配。