Server Error in '/' Application. Could not load file or assembly 'System.Web.WebPages.Deployment, Version=3.0.0.0, - asp.net-mvc-5

Server Error in '/' Application.
Could not load file or assembly 'System.Web.WebPages.Deployment, Version=3.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.Deployment, Version=3.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.
Assembly Load Trace: The following information can be helpful to determine why the assembly 'System.Web.WebPages.Deployment, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' 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:
[FileNotFoundException: Could not load file or assembly 'System.Web.WebPages.Deployment, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.]
System.Web.WebPages.WebPageRoute.DoPostResolveRequestCache(HttpContextBase context) +0
System.Web.WebPages.WebPageHttpModule.OnApplicationPostResolveRequestCache(Object sender, EventArgs e) +89
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +141
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.2053.0

Go to the references find the system. Web.webpages.deployment then go to the properties then check the version and then insert in to Web config file
I hope it helps.

Related

How to resolve following issue : 'Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' error

getting this issue for crystal report: 'System.IO.FileLoadException: Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)'...i have added log4net.dll on azure server via filezilla...
what steps to be done to resolve this issue

Is there any solution for not a file URL problem?

I get this error while i run my application:
{System.TypeLoadException: Could not load type of field due to: Could not load file or assembly 'System.IO.Compression, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies.
Any solution for this exception?

Is it possible to reference external assembly with native dependencies in Azure function?

I'm getting following exception when doing aforementioned:
2017-12-10T12:40:39.771 Exception during runtime resolution of assembly 'Affdex, Version=3.4.1.1320, Culture=neutral, PublicKeyToken=null':
'System.IO.FileLoadException: Could not load file or assembly 'Affdex, Version=3.4.1.1320, Culture=neutral, PublicKeyToken=null'
or one of its dependencies. Attempt to load an unverifiable executable with fixups (IAT with more than 2 sections or a TLS section.) (Exception from HRESULT: 0x80131019)
File name: 'Affdex, Version=3.4.1.1320, Culture=neutral, PublicKeyToken=null' ---> System.IO.FileLoadException: Attempt to load an unverifiable executable with fixups
Is there a location that Azure Function runtime looks for dependencies (like Sys32/Inetsrv in Windows)?

Can you use project.json in an azure service fabric project?

I'm trying to use project.json to make managing packages easier in a Service Fabric project.
However it is failing and I think it is due to not including ServiceFabricServiceModel.dll in the services. I can see the dll in the nuget packages in C:\Users\nick.nuget\packages\Microsoft.ServiceFabric.Actors\2.0.135\lib\net45, but the nuspec file does not reference it.
There are quite a few errors when trying to deploy.
For example
Exception thrown during async task execution
System.IO.FileNotFoundException: Could not load file or assembly 'ServiceFabricServiceModel, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
File name: 'ServiceFabricServiceModel, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
at Microsoft.ServiceFabric.Services.Common.FabricServiceConfigSection.Initialize()
at Microsoft.ServiceFabric.Services.Remoting.FabricTransport.FabricTransportServiceRemotingProviderAttribute.CreateServiceRemotingListener(ServiceContext serviceContext, IService service)
at Microsoft.ServiceFabric.Services.Runtime.StatefulServiceReplicaAdapter.<OpenCommunicationListenersAsync>d__1b.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.ServiceFabric.Services.Runtime.StatefulServiceReplicaAdapter.<System.Fabric.IStatefulServiceReplica.ChangeRoleAsync>d__5.MoveNext()
=== Pre-bind state information ===
LOG: DisplayName = ServiceFabricServiceModel, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
(Fully-specified)
LOG: Appbase = file:///C:/SfDevCluster/Data/_App/_Node_1/SceneSkopePlatformType_App0/ServiceRegistrationServicePkg.Code.1.1.13 (2016-04-05 16.10.16Z)/
LOG: Initial PrivatePath = NULL
Calling assembly : Microsoft.ServiceFabric.Services, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\SfDevCluster\Data\_App\_Node_1\SceneSkopePlatformType_App0\ServiceRegistrationServicePkg.Code.1.1.13 (2016-04-05 16.10.16Z)\ServiceRegistrationService.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference: ServiceFabricServiceModel, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: The same bind was seen before, and was failed with hr = 0x80070002.
This is a breaking change how dotnet cli handles not listed assemblies in nuget packages. For "old style" projects VS2015 copies this assembly to the project output, but the dotnet cli does not.
Until it's fixed, you can either wrap the assembly or copy it to the output in a postpublish step.
The assembly is downloaded to:
%userprofile%.nuget\packages\Microsoft.ServiceFabric.Services\2.0.135\lib\net45
MSFT solved this in the latest nuget package version 2.1.150

IIS skip assembly binding

I have a problem starting a Web Application of mine, which runs under IIS 8.
The 'yellow screen of death' states this:
Could not load file or assembly 'RegexAssemblyBuilder, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b40604c47d15475b' 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 'RegexAssemblyBuilder, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b40604c47d15475b' 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 'RegexAssemblyBuilder, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b40604c47d15475b' could not be loaded.
=== Pre-bind state information ===
LOG: User = IIS APPPOOL\XYZweb
LOG: DisplayName = RegexAssemblyBuilder, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b40604c47d15475b
(Fully-specified)
LOG: Appbase = file:///C:/Code/Application/XYZ 4-Web/ABC.XYZ.Web/
LOG: Initial PrivatePath = C:\Code\Application\XYZ 4-Web\ABC.XYZ.Web\bin
Calling assembly : ABC.RegularExpressions, Version=3.1.0.0, Culture=neutral, PublicKeyToken=f59eabe05cc67589.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Code\Application\XYZ 4-Web\ABC.XYZ.Web\web.config
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference: RegexAssemblyBuilder, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b40604c47d15475b
LOG: The same bind was seen before, and was failed with hr = 0x80070002.
Stack Trace:
[FileNotFoundException: Could not load file or assembly 'RegexAssemblyBuilder, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b40604c47d15475b' or one of its dependencies. The system cannot find the file specified.]
System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type) +0
System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext) +371
System.ModuleHandle.ResolveTypeHandle(Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext) +19
System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) +319
System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg) +203
System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent) +1179
System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType) +146
WebActivator.AssemblyExtensions.GetActivationAttributes(Assembly assembly) +114
WebActivator.ActivationManager.RunActivationMethods() +286
WebActivator.ActivationManager.RunPreStartMethods() +38
WebActivator.ActivationManager.Run() +56
[InvalidOperationException: The pre-application start initialization method Run on type WebActivator.ActivationManager threw an exception with the following error message: Could not load file or assembly 'RegexAssemblyBuilder, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b40604c47d15475b' or one of its dependencies. The system cannot find the file specified..]
System.Web.Compilation.BuildManager.InvokePreStartInitMethodsCore(ICollection`1 methods, Func`1 setHostingEnvironmentCultures) +12880923
System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +12880632
System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath) +240
System.Web.Compilation.BuildManager.ExecutePreAppStart() +152
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +1151
[HttpException (0x80004005): The pre-application start initialization method Run on type WebActivator.ActivationManager threw an exception with the following error message: Could not load file or assembly 'RegexAssemblyBuilder, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b40604c47d15475b' or one of its dependencies. The system cannot find the file specified..]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +12880068
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +12721257
Now, I do have this RegexAssemblyBuilder.exe file in my solution and if I paste it into the bin folder and refresh the page everything works. It is also very likely that there is some issue about the calling assembly which looks for this file, and I have already informed my colleagues about that (I didn't develop it...). In the meantime, to make it work, and for future knowledge, I would like to know if there is the chance to tell IIS not to resolve this binding (which by the way I never use). I can't remove the calling .dll though.
Thank you
You could just set the Build Action to Content and then set Copy To Output Directory to Copy Always to have this assembly added to the bin directly at all tiimes. Otherwise, you could remove the reference to the executable from the project properties, or check to make sure that there is no mention of it in the web.config file. There is no method to prevent IIS from binding to an assembly when it is referenced inside a project. IIS builds up all the referenced assemblies when it does its initial compilation on the first request of the application.

Resources