Could not load file or assembly System - asp.net

We have a customer that is using Server 2008 x86 II7 with asp.net 3.5SP1. When our asp.net application is installed we are getting the following error:
Could not load file or assembly 'System, Version=2.0.50727'
Has anyone ran into this issue? Any help would be greatly appreciated.

Check your applications web.config - are you binding to that version for some reason by any chance?
Its possible it is referencing the wrong version. The assembly version is 2.0.0.0 but the file version is 2.0.50727. Once you open up the gac, right click on the System library for 2.0.0.0 and look at the file version there. What are the results? If its missing, Install asp.net 2 (asp.net 3.5 were files included on top of v2 assemblies - for asp.net it did not replace them)

Related

How to install ASP.NET MVC 5 on a server?

I just updated my website from MVC 4 to MVC 5.
Now when I want to run it on my web server instead of my development machine it does not work.
It think it is because I need to install the MVC 5 libraries on the server but I can't find them.
I downloaded WebMatrix 3 hoping it would provide a way to install it but it only gives me the ability to install MVC 4.
What should I install to be able to run a ASP.NET MVC 5 application?
(without installing Visual Studio 2013)
EDIT:
I disabled custom errors and eror what I have:
Could not load file or assembly 'System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
EDIT 2:
I found out that the problem was due to one of my dependencies which was using the version 2.0.0.0 of razor.
When you deploy your app just make sure that all the assemblies are being deployed to your production environment in the bin folder. ASP.NET MVC is an xCopy deployment, so you don't have to install anything.
You might want to check that your Production environment has ASP.NET 4.0 and 4.5 registered.
MVC5 and future version of MVC doesn't require to installed on Windows Server. MVC5 app have everything as packages. You didn't need anything to install it.
What is required on server is copy of every library and assembly that you have used in your app. For fix this, Just make sure that everything on your bin folder is called same on server instead of server is looking for it's own GAC for assembly used in your app.
If you didn't found all the packages then you can install nuget packages on server by cmd.
The best is to do a Publish, right click on your project in Solution Explorer and select 'Publish'. Basically it will compile your solution and dump all the assemblies/artifacts to either your webserver, ftp or a local folder.
Make sure all your assembly references are being copied to the deployment directory. To do this you can change the <Reference...> tag in your .project file. Optionally, you can use visual studio's property setter to set the "Copy Local" property of each dll reference to "True".

Error: This assembly is built by a runtime newer than the currently loaded runtime

I have downloaded published (code behind files are no there, combined with dll in bin folder) web application from Window Server 2008 where it is hosted, and open it with Visual Studio when I debug that application it shows following error:
"Could not load assembly because this assembly is built by a runtime newer than the currently loaded runtime"
I don't know how can I solve this problem and test application locally.
Please help me.
This errors happens when the DotNet framework you are using is of older version than the one used to build the assembly. You need to check which version of framework is used to build those assemblies and then use the same or higher to debug too.
I was getting this same error when running an installer for a Windows service, even when running the installer on the PC the installer was built on.
It turned out that although the Windows service project had been updated to .NET 4.5, the Setup project that was making the installer was still set to use .NET 2.0.
To check if the Setup project is using an older version of .NET than the project to be installed, in the Visual Studio Solution Explorer:
Expand the Setup project;
Under the Setup project, expand Detected Dependencies;
Under Detected Dependencies select Microsoft .NET Framework and check the Version property. Select the appropriate .NET version from the dropdown list;
Re-build the Setup project to create a new version of the installer.
This error can have a lot of other reasons, too. I had the same problem, and nothing helped until I stumbled across this:
TlbExp.exe error:This assembly is built by a runtime newer
I just ran into this issue when the assembly was built with a target framework of .NET 4, and v4.0.30319 was installed on the server, and other 4.0 apps were running successfully.
The problem arose because the app had originally been built targeting 2.0, and new 4.0 assemblies were pushed, but not the app.config file, which we generally update separately.
This means the supportedRuntime attribute was not updated in the config and caused the error. Adding the following to the app.config fixed our issue:
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup>
One the the assemblies reference in the project might be built using a newer version of .net, check version of every assembly reference and correct accordingly.
Also check the application pool that this web site is running as. It could be framework 2.0 default on some older windows servers. Change it to framework 4.0.

Could not load file or assembly 'Microsoft.Exchange.WebServices, Version=14.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

I'm working on a project that accesses the Exchange Server. Before I replaced the project to a server, everything went fine. But now I'm getting this error.
I don't find what I search in Google, so I hope someone of you can help me. I appreciate that.
You should provide the specified assembly with your application or install it on your server.
The answer is: I copied the dll and xml file (which you get when installing EWS Managed API) to the bin-folder of my project. And it works!
I had the same exact error, in VS2005, .Net 2 and 3.5
This is how I resolved it, and I had to find another solution, because this always failed and Windows would not let me register the DLL.
regsvr32 "C:\Program Files\Microsoft\Exchange\Web services\1.1\Microsoft.Exchange.WebServices.dll"
I went into the .Net Framework Configuration Wizard from Administration tools in Windows XP. Mine is .NET Framework 2.0 Configuration (version 2.0.50727.42).
I then went into Runtime Security Policy -> Increase Assembly Trust and pointed to the above DLL in my C drive. It was set to NO TRUST, for some reason! I changed it to FULL TRUST.
I then closed and re-opened my VS2005 project and everything is now working fine.
Regards,

Error message about existing

I'm using VS 2010 with ASP.net MVC 2.
I recieved a program that was completed and when I was debugging the program I recieve an error message.
"Error 4 The type 'System.Web.Routing.RouteTable' exists in both 'C:\Program Files\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\System.Web.dll' and 'C:\Documents and Settings\Vincent\Desktop\3\Manning.ASP.NET.MVC.2.in.Action.Jun.2010\aspnetmvc2inaction_code\lib\AspNetMvc\System.Web.Routing.dll' C:\Documents and Settings\Vincent\Desktop\3\Manning.ASP.NET.MVC.2.in.Action.Jun.2010\aspnetmvc2inaction_code\src\Chapter01\GuestBook\Global.asax.cs"
and
"Error 1 The type 'System.Web.Routing.RequestContext' exists in both 'c:\Program Files\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\System.Web.dll' and 'c:\Documents and Settings\Vincent\Desktop\3\Manning.ASP.NET.MVC.2.in.Action.Jun.2010\aspnetmvc2inaction_code\lib\AspNetMvc\System.Web.Routing.dll' C:\Documents and Settings\Vincent\Desktop\3\Manning.ASP.NET.MVC.2.in.Action.Jun.2010\aspnetmvc2inaction_code\src\Chapter01\GuestBook\Controllers\AccountController.cs".
The program was converted into VS 2010 format.
What should I do?
// Fullmetalboy
When you convert a project from .Net 2.0/3.5 to 4.0 in VS2010 the web projects will prompt you to upgrade the framework to 4.0 but you will need to manually go into the project properties and upgrade class library projects and certain other projects manually in the project properties. So this type of error is probably caused by your web project referencing the 4.0 version of System.Web.Routing but a class library in your solution is still referencing the 3.5 version.
One of the projects in your solution is referencing a single type (RouteTable/RequestContext) in two different places. I always start with cleaning and rebuilding the solution, but if that doesn't fix it, you're going to have to check the project references and resolve it that way. If all else fails, try to make a new project from scratch and manually add the references and projects you need and then copy and paste your old code.
Someone copied the ASP.NET MVC source code into the "lib" folder of your application and either included that folder in the project (so it is getting built when you build your project) or he/she built it before you got it and referenced it from within the project. Now it is in conflict with the ASP.NET libraries that exist in default installation folder on the system 'c:\Program Files\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\System.Web.dll'.
Since you're using the .NET 4.0 Framework, the library System.Web.Routing is ambiguous. Make sure you have referenced System.Web.dll (version 4.0) and remove the reference to System.Web.Routing.dll

What is my problem with ASP.NET pubslishing?

I am done testing my site and I want to upload it to a site like this
http://www.university.edu/mydepartment/myname
the admin told me the server runs on .NET 3.5. So i used Linq ...
now i tried to upload the site by two ways:
when i just copy everything (with modification of web.config database settings) i get an error:
CS0246: The type or namespace name
'DataClassesDataContext' could not be
found (are you missing a using
directive or an assembly reference?)
Version Information: Microsoft .NET
Framework Version:2.0.50727.3082;
ASP.NET Version:2.0.50727.3082
Note here it says version 2.0
did he just lie to me? or its my configuration mistake?
anyway, i added the reference, nothing changes.
I tried also publishing (Build, publish) with option to keep the pre-comiled site updatable, and I get one line saying:
this is a makefile and should be
deleted!
what is going on?
It looks like it can't find your DBML file, or your DBML file isn't called "DataClasses.dbml". Also, the .NET Framework Version is not lying. It is reporting the CLR version, which is still 2.0 for the 3.5 .NET Framework.

Resources