Problems upgrading MVC Mini Profiler to latest release - c#

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.

Related

getting TypeInitializationException Oracle.DataAccess

I have Windows 10 machine. In that I am running a c# project which references Oracle.DataAccess.dll. I have installed ODAC112012_32Bit. There is a dll NexFen.FirmLoad which accesses Oracle dll. When I run the project I get following error:
System.TypeInitializationException: The type initializer for
'NexGen.FirmLoad.AppUtils' threw an exception. --->
System.IO.FileLoadException: Could not load file or assembly
'Oracle.DataAccess, Version=4.112.3.0, Culture=neutral,
PublicKeyToken=89b483f429c47342' or one of its dependencies. The
located assembly's manifest definition does not match the assembly
reference. (Exception from HRESULT: 0x80131040) --->
System.IO.FileLoadException: Could not load file or assembly
'Oracle.DataAccess, Version=4.112.1.2, Culture=neutral,
PublicKeyToken=89b483f429c47342' or one of its dependencies. The
located assembly's manifest definition does not match the assembly
reference. (Exception from HRESULT: 0x80131040) --- End of inner
exception stack trace --- at NexGen.FirmLoad.AppUtils..cctor()
--- End of inner exception stack trace --- at NexGen.FirmLoad.LoadFirmware.d__0.MoveNext()
Check that your project meets all the following conditions:
You have an Oracle client installed (e.g. Oracle Instant Client)
Oracle.DataAccess.dll and the Oracle Client and the compile target of your application have all the same architecture (i.e. 32-bit vs. 64-bit)
Version of Oracle.DataAccess.dll is the same version as your Oracle client (even the minor version has to match). Your error message indicates version 4.112.3.0 and 4.112.1.2, perhaps there is your problem. Check installed versions in your GAC and Policies.

I reinstalled Entity Framework and now it's giving error

I initially got a problem in DB due to which I re-installed entity framework (earlier my version was 5.0 and now I installed 6.1.3), I am connected to SQL server but now I am getting an error which says:
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: An error occurred creating the configuration section handler for entityFramework: Could not load file or assembly 'EntityFramework, Version=6.1.3, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Please tell me how to resolve it.
Thanks
Try to update your EntityFrame Work using this command from
update-Package EntityFramework
Also, make sure that the versions on packages.config and web.config match

Could not load file or assembly Microsoft.Practices.ServiceLocation, Version=1.3.0.0

Here is the error I'm getting when I run my application (.NET 4.5):
Server Error in '/' Application.
Could not load file or assembly 'Microsoft.Practices.ServiceLocation, Version=1.3.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 'Microsoft.Practices.ServiceLocation, Version=1.3.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.
Assembly Load Trace: The following information can be helpful to determine why the assembly 'Microsoft.Practices.ServiceLocation, Version=1.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' could not be loaded.
=== Pre-bind state information ===
LOG: DisplayName = Microsoft.Practices.ServiceLocation, Version=1.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
(Fully-specified)
LOG: Appbase = file:///C:/Users/Austin/Documents/FileStore/FileStore.Web/
LOG: Initial PrivatePath = C:\Users\Austin\Documents\FileStore\FileStore.Web\bin
Calling assembly : Chicago.Security, Version=1.0.5826.21195, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\Austin\Documents\FileStore\FileStore.Web\web.config
LOG: Using host configuration file: C:\Users\Austin\Documents\IISExpress\config\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Redirect found in application configuration file: 1.3.0.0 redirected to 1.3.0.0.
LOG: Post-policy reference: Microsoft.Practices.ServiceLocation, Version=1.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: The same bind was seen before, and was failed with hr = 0x80070002.
Stack Trace:
[FileNotFoundException: Could not load file or assembly 'Microsoft.Practices.ServiceLocation, Version=1.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.]
Chicago.Security.AuthenticationModule.application_AuthenticateRequest(Object sender, EventArgs e) +0
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +141
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69
I installed the nuget package CommonServiceLocator, but I'm still getting this error. The weird thing is that there is an assembly binding redirect in my web.config file, but the assembly does not appear in the reference list for my project and I cannot find it anywhere to add it. I'm still relatively new to ASP.NET, so I can't seem to pin down what the issue is exactly. Another thing I found to try is to set 'Enable 32 bit applications' to true for my application pool in the IIS Manager, but this did not fix my problem. I've been stuck on this for a while, so any help would be appreciated.
Well after hours of research and trying different things, uninstalling and reinstalling CommonServiceLocator from Nuget seemed to do the trick. I'm still amazed at how messy .NET apps are with their dependencies.
Make sure you have installed version 1.3.0 and not a different version.
Nuget link: https://www.nuget.org/packages/CommonServiceLocator/1.3.0
Open VS--> Tools --> Nuget Package manager--> Package manager Console
>PM Install-Package CommonServiceLocator
This should help!
I was getting this error because I was using the new syntax of C# 7.0 in an older version. Once I reverted back to the older syntax, this was resolved.
Specifically, I was using:-
// Newer syntax.
if (int.TryParse(args.Value, out var value))
{
args.IsValid = value > 0;
}
// Older supported version which resolved the issue.
int value;
if (int.TryParse(args.Value, out value))
{
args.IsValid = value > 0;
}
I had opened a VS2015 Solution in VS2017 and found missing references, not sure why.
Could not locate the assembly "CommonServiceLocator"
Could not locate the assembly "Unity.RegistrationByConvention"
Could not locate the assembly "Unity.ServiceLocation"
Could not locate the assembly "Unity.Configuration"
Could not locate the assembly "Unity.Interception.Configuration"
Could not locate the assembly "Unity.Container"
Build your project first to get a list of missing references (that show the release numbers). Then open the NUGET package manager for the solution and simply reinstall. Note: there are dependency chains to the install order, if an install fails, find the pre-req. dependency and install first, then try again. Takes about 10 minutes to correct.
They have updated the package, below change is required in code if you download the latest commonservicelocator package.
using Microsoft.Practices.ServiceLocation;
to
using CommonServiceLocator;

How to solve .Net Framework Version Issue?

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.

log4net not logging and throwing error

I have been using log4Net to write in a text file when there is any exception in my web service, this was working but today it started to throw error.
System.Web.Services.Protocols.SoapException: Server was unable to
process request. ---> System.TypeInitializationException: The type
initializer for.. threw an exception.
---> System.IO.FileLoadException: Could not load file or assembly
'log4net, Version=1.2.9.0, Culture=neutral,
PublicKeyToken=b32731d11ce58905' or one of its dependencies. The
located assembly's manifest definition does not match the assembly
reference. (Exception from HRESULT: 0x80131040)
File name: 'log4net, Version=1.2.9.0, Culture=neutral,
PublicKeyToken=b32731d11ce58905'
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 have any inputs on this stack info, pls. share it.
Did you change the code, or did this just start happening?
I've seen this error occur when the target processor architecture was mismatched. Did you change that by any chance?
If this isn't the case, and you have Windows SDK installed, you can use the Fusion Log Viewer to view assembly binding logs. The utility should be installed on your machine.

Categories

Resources