I have installed vs2012 (11.0.50727.1),
I opened a new MVC4 with .NET 4.5 solution,
i create a simple HomeController and as I've wanted to start it locally, i have received this very strange error:
How can resolve it? What is this error and why it's happens???
Thank you in advance, for any of your help.
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
I have converted a project from MVC3+.NET4 to MVC4+.NET4.5 and I receive the exception Entry point was not found when invoking a controller's action.
My solution was to insert an assembly binding redirect inside web.config to point at MVC 4 assemblies:
<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>
I don't know the exact cause of the problem, maybe some third party library that still references MVC3.
The same error appears when you switch you project from MVC3 to MVC4 and forget to change System.Web.WebPages.Razor, Version=1.0.0.0 to System.Web.WebPages.Razor, Version=2.0.0.0 in the web.config.
Old post but if you encounter it prior to the mvc woes (System.Mvc.dll update e.g x.0.0.1) you could check the bindingRedirect tag(4.0.0.0 -> 4.0.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>
If you are catching this error in WebAPI Controller - you need fix binding
version of 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>
you should also check that all of the projects in your solutions reference the latest versions of the dll's, and that there are no inconsistent versions being used by different sub-projects.
despite running nuget uninstall, install and update I found the tests project was referencing an old version of the system.net.http
If you are using .net 4.5 and adding a binder to ModelBinders.Binders collection from a .net 4.0 library you will also get such error.
Do you have something like this in your 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>();
From the stack trace you posted System.Web.Mvc.IDependencyResolver.GetService(Type serviceType) +0 would suggest one (or more) of your dependencies don't resolve.
You could try commenting one or more of them out and try to narrow down which one is failing to resolve.
Old post but just to add for anyone looking
This seems like a catch all error. I got it when my web.config used an external section and that section was excluded from the Visual Studio project, i.e. using this
<sessionState configSource="SystemWeb.config" />
Try this.. in visual studio go to Package Administrator Console and type:
update-package
I faced this problem and solved it by
1. uninstall-Package Microsoft.AspNet.Mvc (I need to uninstall something else before I can uninstall AspNet.MVC successfully)
2. Install-Package Microsoft.AspNet.Mvc -Version 4.0.20710
3. Rebuild and deploy
Not MVC specific in my case, but had just started getting this error:
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.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +8008
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.1055.0
What caused that was that I had published to the webserver folder from Visual Studio and selected to Precompile the app (using a .NET 4.5 project), with allow precompiled site to be updateable setting btw.
Probably my issue was that the site is running at .NET 4.0 on IIS, whereas the precompiled version placed in bin folder during the publish action was for 4.5. When I removed the "bin" folder from the website it run fine again.
Just update "System.Web.Mvc" with "nuget"
Related
I installed gridmvc latest using nuget. Things work fine in my local environment but when i deploy it to production, I get this error. Please help.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS1705: Assembly 'GridMvc, Version=2.0.4.0, Culture=neutral, PublicKeyToken=null' uses 'System.Web.Mvc, Version=4.0.0.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35' which has a higher version than referenced assembly 'System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
Source Error:
[No relevant source lines]
Source File: Line: 0
Show Detailed Compiler Output:
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34212
Try to clean & compile in release before publishing to production and let me know if the same issue happens to you.
Please follow the guide below: http://www.codeproject.com/Tips/597253/Using-the-Grid-MVC-in-ASP-NET-MVC
and make sure you've done the same steps while configuring your environment and code.
I hope the above will address you issue.
It's resolved now. All I had to do was, remove old referenced dll under References in this case (System.Web.Mvc 4.0.0.0). Add new reference System.Web.Mvc 4.0.0.1. Click on the new referenced dll, in the properties windows set Copy to Local = True.
The in my project's root web.config file, change the following
FROM
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
TO
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.1" />
</dependentAssembly>
Then do clean and rebuild. Then copy the new System.Web.Mvc (4.0.0.1) dll over to production.
My application was working fine and after I did some upgrades I am getting this error.
Server Error in '/' Application.
Attempt by security transparent method 'System.Web.Mvc.PreApplicationStartCode.Start()' to access security critical method 'System.Web.WebPages.Razor.PreApplicationStartCode.Start()' failed.
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.MethodAccessException: Attempt by security transparent method 'System.Web.Mvc.PreApplicationStartCode.Start()' to access security critical method 'System.Web.WebPages.Razor.PreApplicationStartCode.Start()' failed.
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.
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18055
I cannot remember the updates I did. Is there a way to fix this?
I think the issue has been solved, but if not, use this package from Nuget:
Install-Package Microsoft.AspNet.Mvc -Version 5.0.0
I have wasted a day for this error but this single line has done the work for me
tried . . . Install-Package Microsoft.AspNet.Mvc -Version 5.0.0
and. . . Install-Package -Id Microsoft.AspNet.WebHelpers
both with no success, finally had to update all packages via nuget. . worked!!
http://www.3dbuzz.com/forum/threads/202082-ASP-net-MVC-Error-before-application-start
If you're using visual studio open the nuget packages windows and run
Update-Package, this will update all your dll to the last version. If
it still not work, see this page:
http://www.asp.net/mvc/tutorials/mvc-5/how-to-upgrade-an-aspnet-mvc-4-and-web-api-project-to-aspnet-mvc-5-and-web-api-2
I got this error when deploying a site where Mvc had been upgraded from 4 to 5 but I had not updated web.config.
Changing from this:
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
to this:
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
</dependentAssembly>
solved the problem for me.
For me also same error occured.
It was fixed by installing the NuGet package
Install-Package -Id Microsoft.AspNet.WebHelpers
I had a similar problem, and solved it by based on the article Updating Razor 2.0 to 3.0 with Asp.net MVC by by Anthony Fassett
The following block of code was missing from my Web.Config:
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages.Razor" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
In my case it was an incompatibility issue. I had theses pacakges:
Microsoft.AspNet.Mvc version 4.x
Microsoft.AspNet.Razor and Microsoft.AspNet.WebPages, version 3.x
I suppose that upgrading Mvc to 5.x would have worked, but I needed to keep Mvc 4.x, so i had to downgrade Razor and Mvc to 2.x. To do so, you just have to install the older version, like this:
Install-package Microsoft.AspNet.WebPages -version 2.0.30506
Install-Package Microsoft.AspNet.Razor -Version 2.0.30506
After downgrading these packages, the first error disappeared, but there was still another error related to a problem in web.config. I had to change the binding redirect for Razor:
<dependentAssembly>
<assemblyIdentity name="System.Web.Razor" ... />
<!--bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" /-->
<bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
I don't know why, but the binding redirect wasn't updated by the Nuget installation, which should have done it.
There are multiple solutions for this problem:
Follow the tutorial on upgrading your asp.net solution
Don't forget to remove the Microsoft-Web-Helpers dll and install the nuget package Microsoft.AspNet.WebHelpers
Then, make sure you have upgraded all your nuget Packages (use "Upgrade-Package") and check your dll's in web.config.
The error is probably an action in an old DLL, when you are converting your project.
In my case, a nuget installation had changed my Web.Config:
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-5.1.0.0" newVersion="1.1.0.0" />
</dependentAssembly>
newVersion="1.1.0.0"** should be newVersion="5.1.0.0"
Right Click to Project -> Manage Nuget Packages for solution than find
Microsoft.AspNet.Mvc and Microsoft.Net.Compilers update latest versions
I solved my problem by applying the "Install-Package Microsoft.AspNet.Mvc" command.
After that I solved my project with Web API.
I received this error when I upgraded a NuGet package - 'Microsoft.AspNet.Web Pages' version 3.2.3. I am using VS2012, starting a new vanilla 'ASP.NET MVC 4 Web Application' with template 'Internet Application' using Windows Authentication or Windows Azure authentication.
Perhaps the update is not compatible with other components, and these other components must also be upgraded. Other answers suggest updating Microsoft.AspNet.Mvc, Microsoft.Net.Compilers, and/or Microsoft.AspNet.WebHelpers.
I am working on ASP.NET Web API project and fetch same problem after adding following nuget CacheCow.Server.EntityTagStore.SqlServer
It solved installing this one
Install-Package Microsoft.AspNet.Mvc
Install-Package -Id Microsoft.AspNet.WebHelpers
Install-Package Microsoft.AspNet.Mvc -Version 5.0.0
This worked for me
I am asp.net death page, this is coming after i upgraded webgrease and bootstrap for mvc4 using nuget.
Server Error in '/' Application.
Could not load file or assembly 'WebGrease' or one of its
dependencies. Strong name signature could not be verified. The
assembly may have been tampered with, or it was delay signed but not
fully signed with the correct private key. (Exception from HRESULT:
0x80131045) 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.IO.FileLoadException: Could not load file
or assembly 'WebGrease' or one of its dependencies. Strong name
signature could not be verified. The assembly may have been tampered
with, or it was delay signed but not fully signed with the correct
private key. (Exception from HRESULT: 0x80131045)
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.
Assembly Load Trace: The following information can be helpful to
determine why the assembly 'WebGrease' could not be loaded.
Version Information: Microsoft .NET Framework Version:4.0.30319;
ASP.NET Version:4.0.30319.18045
Force uninstall the package using Package Manager Console
uninstall-package -f WebGrease
then install the previous version 1.3.0 using the following command
install-package WebGrease -Version 1.3.0
Open your Web.config file and replace below dependency under runtime tag
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.3.0.0" newVersion="1.3.0.0" />
I had to add the following code in web.config:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
</dependentAssembly>
...
I had the same error. It was happened because nuget updated WebGrease dll but didn't update a web.config file (especial version of used dll).
So I changed next line in my web.config:
<bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
to
<bindingRedirect oldVersion="0.0.0.0-1.6.5135.21930" newVersion="1.6.5135.21930" />
Number of version (1.6.5135.21930) I took from dll properties.
After this everything works correct.
We’re aware of an error in the assembly’s strong name signature and so we’re actively working to release an updated version as soon as possible. For now, we have unlisted the WebGrease 1.5.1 package from nuget.org.
Try this: Check if the above dll's are in GAC. If so, in your custom app bin folder check if the above dll's are present if so remove them from your reference.
I am working on a sample message handler service using NServiceBus in a .NET 4.5 project. It works fine as long as DefaultBuilder is used. To configure the container for other services with Autofac as soon as reference to Autofac is added and DefaultBuilder is changed to AutofacBuilder, I get exception as shown below. reference to NServiceBus.ObjectBuilder.Autofac.dll is already in the project.
Exception when starting endpoint, error has been logged. Reason: Could
not load file or assembly 'Autofac, Version=2.6.1.841,
Culture=neutral, PublicKeyToken=17863af14b0044da' or one of its
dependencies. The located assembly's manifest definition does not
match the assembly reference. (Exception from HRESULT: 0x80131040)
WRN: Comparing the assembly name resulted in the mismatch: Major Version
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
What am I doing wrong? I have tried Nuget, manual reference, changing target framework to 4.0.
EDIT
After adding the binding redirects, the error message changes to
Method not found: 'Autofac.Builder.IRegistrationBuilder`3<!0,!1,!2>
Autofac.Builder.IRegistrationBuilder`3.PropertiesAutowired(Autofac.PropertyWiringFlags)'.
at NServiceBus.Hosting.GenericHost.Start() in c:\BuildAgent\work\nsb.master_6\src\hosting\NServiceBus.Hosting\GenericHost.cs:line 43
at NServiceBus.Hosting.Windows.WindowsHost.Start() in c:\BuildAgent\work\nsb.master_6\src\hosting\NServiceBus.Hosting.Windows\WindowsHost.cs:line 55
at NServiceBus.Hosting.Windows.Program.<>c__DisplayClass8.<Main>b__4(WindowsHost service) in c:\BuildAgent\work\nsb.master_6\src\hosting\NServiceBus.Hosting.Windows\Program.cs:line 97
at Topshelf.Internal.ControllerDelegates`1.StartActionObject(Object obj) in c:\Projects\TopShelfForNSB\src\Topshelf\Internal\ControllerDelegates.cs:line 17
at Topshelf.Internal.IsolatedServiceControllerWrapper`1.<>c__DisplayClass2.<set_StartAction>b__1(TService service) in c:\Projects\TopShelfForNSB\src\Topshelf\Internal\IsolatedServiceControllerWrapper.cs:line 65
at Topshelf.Internal.ServiceController`1.<.cctor>b__1(ServiceController`1 sc) in c:\Projects\TopShelfForNSB\src\Topshelf\Internal\ServiceController.cs:line 35
at Magnum.StateMachine.LambdaAction`1.Execute(T instance, Event event, Object parameter) in :line 0
at Magnum.StateMachine.EventActionList`1.Execute(T stateMachine, Event event, Object parameter) in :line 0
App.Config
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Autofac" publicKeyToken="17863af14b0044da" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
NServiceBus v3.3.5 uses Autofac v2.6.1.841, if you are referencing a different version you need to add binding redirects.
I receive the following two errors when I try to compile my MVC4 web project:
CA0058 Error Running Code Analysis CA0058 : The referenced assembly 'DotNetOpenAuth.AspNet, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246' could not be found. This assembly is required for analysis and was referenced by: C:\Users\bflynn\Visual Studio Sites\mnp\bin\mnp.dll, C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v2.0\Assemblies\Microsoft.Web.WebPages.OAuth.dll. [Errors and Warnings] (Global)
and
CA0001 Error Running Code Analysis CA0001 : The following error was encountered while reading module 'Microsoft.Web.WebPages.OAuth': Assembly reference cannot be resolved: DotNetOpenAuth.AspNet, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246. [Errors and Warnings] (Global)
I recently added the DotNetOpenAuth.AspNet package to the application, and it seems tied to that. I have Cleaned, Rebuilt, Open/Closed the program, Uninstalled/Re-installed the package, yet the errors persists.
I just ran into this too.
Don't upgrade DOA to 4.1
It looks like the aspnet dll has a specific version referenced. Altough it's .nuspec file says 4.0+ is ok...
Solution:
Uninstall-Package -Force each DotNetOpenAuth package (core /aspnet /oauth/openid etc)
Install-Package DotNetOpenAuth.AspNet -Version 4.0.4.12182
I used this to resolve the issue:
1. Uninstall-Package Microsoft.AspNet.WebPages.OAuth –RemoveDependencies
2. Install-Package DotNetOpenAuth.AspNet -Version 4.0.4.12182
3. Install-Package Microsoft.AspNet.WebPages.OAuth
I ran into the same issue the other day and reported it http://aspnetwebstack.codeplex.com/workitem/443
Problem was reported on 21. september 2012. (http://aspnetwebstack.codeplex.com/workitem/443)
It was closed on 5. june 2013 with message:
The next version of MVC will not have a dependency on DotNetOpenAuth. Use the recommended workarounds below.
So I used the workaround https://stackoverflow.com/a/12847018/1016682
Code Analysis error Could not load file or assembly 'System.Net.Http, Version=2.0.0.0 in MVC4 Web API
See Yao's answer. The only solution I found that actually works for this.
I had the same issue. Though the code analysis issue got fixed, the web application wouldn't run because of the following error.
Could not load file or assembly 'DotNetOpenAuth.AspNet' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
It turned that the web.config was not cleaned as part of the uninstall.
I had to remove the following dependentAssembly from web.config under the runtime/assemblyBinding section.
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="DotNetOpenAuth.Core" publicKeyToken="2780ccd10d57b246" />
<bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="DotNetOpenAuth.AspNet" publicKeyToken="2780ccd10d57b246" />
<bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0" />
</dependentAssembly>
<dependentAssembly>
</dependentAssembly>
</assemblyBinding>
</runtime>
The details can be read in http://www.bigcode.net/2013/07/error-running-code-analysis-in-vs2012.html