How to solve .Net Framework Version Issue? - c#

It works fine on server. But now I'm deploying this on new server. I just copied the Package from my old server to this server.
When I browse application, getting the below mentioned error.
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 system cannot find the file specified.
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.FileNotFoundException: 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 system cannot find the file specified.
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.
On new Server its showing .net clr version v4.0.30319, but on old server it is
.net version v4.0.30319 for Application Pool.
Is this Framework related Issue? or m I missing something?

You new server might not have an ASP.NET-MVC installed on. You can set the reference to System.Web.WebPages.Razor copied to local set to true.
Right click on the System.Web.WebPages.Razor in your references and click properties. Set the Copy Local to true.

Related

Code running fine locally but erroring when published live on GoDaddy

Server Error in '/' Application.
Configuration Error
Description: An error occurred during the processing of a
configuration file required to service this request. Please review the
specific error details below and modify your configuration file
appropriately.
Parser Error Message: Could not load file or assembly 'MySql.Data,
Version=6.4.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or
one of its dependencies. The system cannot find the file specified.
Source Error:
An application error occurred on the server. The current custom error
settings for this application prevent the details of the application
error from being viewed remotely (for security reasons). It could,
however, be viewed by browsers running on the local server machine.
Source File: G:\PleskVhosts\dekhoroom.com\httpdocs\web.config Line:
11
Assembly Load Trace: The following information can be helpful to
determine why the assembly 'MySql.Data, Version=6.4.4.0,
Culture=neutral, PublicKeyToken=c5687fc88969c44d' could not be loaded.
WRN: Assembly binding logging is turned OFF. To enable assembly bind
failure logging, set the registry value
[HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There
is some performance penalty associated with assembly bind failure
logging. To turn this feature off, remove the registry value
[HKLM\Software\Microsoft\Fusion!EnableLog].
If you, on your local development machine, have MySql.Data in your GAC, it will not be in your Web app's bin directory. And if it is that bin directory that gets deployed, Sql.Data will not be there. Do not expect a hosting provider to have all kinds of assemblies in the GAC.
So the solution is to deploy all the assemblies your Web app needs. Deploy MySql.Data, and any other assemblies that it depends upon, along with your Web application.
For the same reason, it is a good idea not to install ASP.NET MVC in your GAC but to simply reference it and deploy it along with your Web application.

FileLoadException: Could not load file or assembly 'Microsoft.Practices.ObjectBuilder, Version=1.0.51205.0, Culture=neutral, PublicKeyToken=null'

Im having a WebApplication that runs in vs2010 but the target framework is set as 2.0. The application uses enterprise library. when I execute the application in my local I getting an error
Required permissions cannot be acquired.
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.Security.Policy.PolicyException: Required
permissions cannot be acquired.
and in the stack trace I'm getting error
FileLoadException: Could not load file or assembly
'Microsoft.Practices.ObjectBuilder, Version=1.0.51205.0,
Culture=neutral, PublicKeyToken=null' or one of its dependencies.
If is set the target framework as 4.0 the code executes fine. I have tried the following steps :
set the 'Copy to output directory' in the objectbuilder dll property as
copy always (earlier it was do not copy)
tried adding the trust tag with
trust level="high" originUrl="" and also trust level="low"
originUrl=""
copied the below tags from the machine.config of 4.0 to machine.config of 2.0
section name="fullTrustAssemblies"
type="System.Web.Configuration.FullTrustAssembliesSection, System.Web,
Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
allowDefinition="MachineToApplication"/>
section name="partialTrustVisibleAssemblies"
type="System.Web.Configuration.PartialTrustVisibleAssembliesSection,
System.Web, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a"
allowDefinition="MachineToApplication"/>
but still getting the error. Please let me know what could be the issue..
prob solved.. i took the EL dlls seperately, gave it strong name & registered the assembly in GAC.. and now the code works fine..

Could not load file or assembly 'System.Web, Version=4.0.0.0, Culture=neutral' or one of its dependencies. Access is denied

Seems like there are already 100s of questions like these.. I have search through quite many of them and they don't seem to suggest anything that I haven't tried yet.
I get the error:
Could not load file or assembly 'System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Access is denied.
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 'System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Access is denied.
Source Error:
Line 44: private static IKernel CreateKernel()
Line 45: {
Line 46: var kernel = new StandardKernel();
Line 47: try
Line 48: {
The above code is present in my Ninject Initializer.
I have given "Everyone" Permissions on:
C:\Windows\Microsoft.NET\Framework\v4.0.30319
C:\Windows\Microsoft.NET\Framework64\v4.0.30319
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\ .NETFramework
FusionLog Details:
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable C:\Program Files (x86)\IIS Express\iisexpress.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: DisplayName = System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
(Fully-specified)
LOG: Appbase = file:///F:/TFS/MMSChange/Main/SMRH.MMSChange/SMRH.MMSChange.Web/
LOG: Initial PrivatePath = F:\TFS\MMSChange\Main\SMRH.MMSChange\SMRH.MMSChange.Web\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Found application configuration file (F:\TFS\MMSChange\Main\SMRH.MMSChange\SMRH.MMSChange.Web\web.config).
I have also given everyone permissions on my code's folders. I have tried running ProcMon (which has helped me with the similar problems for different solutions before); but it does not create a single entry for system.web.dll.
I have impersonation built in. I use separate accounts to access the database and that impersonation for the database account breaks this. Without impersonation the app runs fine. (But has no data because all the db calls fail)
Funny thing is though, if I deploy the same code to my local machine and run it via an IIS Web Site: it works. But if I just debug it from my IDE it fails.
I got another instance of ProcMon running and filtered results to show only IISExpress results (Since this is the one which is giving me error).
Then I compiled and launched my application from the IDE and waited for the error to come. After I got the error, I filtered the results by "Access Denied".
Usually I filtered the results to look for system.web.dll, but this time i decided to ignore it.
I found that the only file which was throwing access denied was: "C:\Users\1roj1\Documents\IISExpress\config\aspnet.config" (Where 1roj1 is my user account).
I gave my impersonate user full access to this file and voila everything worked!
I think you need to register .net Freamework 4.0 for IIS for the above issue.
Here are the steps..
Open Command prompt as Administrator
Navigate to "C:\Windows\Microsoft.NET\Framework\v4.0.30319" directory in command prompt
[use the command cd C:\Windows\Microsoft.NET\Framework\v4.0.30319]
Register .net FrameWork for IIS
[use command aspnet_regiis.exe -i]
Restart IIS [use command iisreset].
Done.

Could not load file or assembly 'RadMenu.Net2, Version=4.4.6.0, Culture=neutral, PublicKeyToken=bbe59a8ad3533e68'

Server Error in '/' Application.
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Reference.svcmap: Could not load file or assembly 'RadMenu.Net2, Version=4.4.6.0, Culture=neutral, PublicKeyToken=bbe59a8ad3533e68' or one of its dependencies. The system cannot find the file specified.
Assembly Load Trace: The following information can be helpful to determine why the assembly 'RadMenu.Net2, Version=4.4.6.0, Culture=neutral, PublicKeyToken=bbe59a8ad3533e68' could not be loaded.
Pls help me to resolved this error...
This means that somewhere in your projects and/or web.config(s) you have a reference to this horribly old assembly (I think it is 8 or so years old). Remove it and migrate to the modern AJAX suite.

Problems upgrading MVC Mini Profiler to latest release

I've been using Mini Profiler in dev and production (azure) for a while and LOVE it.
It tried to upgrade to the latest release today via NUGET. The DLL get's placed in the bin but my site gets an error. If I go back to the old dll it works fine. Does anyone know how to fix this?
Server Error in '/' Application.
Could not load file or assembly 'MvcMiniProfiler, Version=2.0.4177.17902, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
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 'MvcMiniProfiler, Version=2.0.4177.17902, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
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 'MvcMiniProfiler, Version=2.0.4177.17902, Culture=neutral, PublicKeyToken=null' could not be loaded.
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
Stack Trace:
[FileLoadException: Could not load file or assembly 'MvcMiniProfiler, Version=2.0.4177.17902, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
MyGlobal.application_BeginRequest(Object sender, EventArgs e) in C:\Users\Nate\Documents\Visual Studio 2010\Projects\TrainerRoad\com.TrainerRoad.DataAccess\MyGlobal.cs:15
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +80
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +270
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.237
Be sure to read the documentation on http://code.google.com/p/mvc-mini-profiler/
In particular:
Ensure you remove all the modifications you made to web.config.
If you are profiling Entity Framework grab the MiniProfiler.EF package
If you are running latest EF see: Problem using SQL Server CE with Entity Framework code-first and ASP.NET MVC 3 and mvc miniprofiler
There is not MiniProfiler version 2.0.4177.17902 so I really do not know where it is coming from.

Categories

Resources