I suppose I forgot something silly while removing Elmah because I'm getting a binding exception at run time...
System.IO.FileNotFoundException: Could not load file or assembly
'Elmah' or one of its dependencies. The system cannot find the file
specified.
A global solution search for the word Elmah (case insensitive) revealed nothing. I have cleaned the solution, emptied the bin folder, checked into IIS express settings. Not a single word about Elmah... I don't know where else to look.
Assembly Load Trace
=== Pre-bind state information ===
LOG: DisplayName = Elmah
(Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: Elmah | Domain ID: 2
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///W:/ImplementationSuiviProjet/Source/Portail/
LOG: Initial PrivatePath = W:\ImplementationSuiviProjet\Source\Portail\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: W:\ImplementationSuiviProjet\Source\Portail\web.config
LOG: Using host configuration file: C:\Users\Pier-Luc Michaud\Documents\IISExpress\config\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/portail/9481be8a/4a40a731/Elmah.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/portail/9481be8a/4a40a731/Elmah/Elmah.DLL.
LOG: Attempting download of new URL file:///W:/ImplementationSuiviProjet/Source/Portail/bin/Elmah.DLL.
LOG: Attempting download of new URL file:///W:/ImplementationSuiviProjet/Source/Portail/bin/Elmah/Elmah.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/portail/9481be8a/4a40a731/Elmah.EXE.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/portail/9481be8a/4a40a731/Elmah/Elmah.EXE.
LOG: Attempting download of new URL file:///W:/ImplementationSuiviProjet/Source/Portail/bin/Elmah.EXE.
LOG: Attempting download of new URL file:///W:/ImplementationSuiviProjet/Source/Portail/bin/Elmah/Elmah.EXE.
Stack Trace
[FileNotFoundException: Could not load file or assembly 'Elmah' or one of its dependencies. The system cannot find the file specified.]
System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName, ObjectHandleOnStack type) +0
System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName) +70
System.RuntimeType.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark) +40
System.Type.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase) +37
System.Web.Compilation.BuildManager.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase) +65
System.Web.Configuration.ConfigUtil.GetType(String typeName, String propertyName, ConfigurationElement configElement, XmlNode node, Boolean checkAptcaBit, Boolean ignoreCase) +38
[ConfigurationErrorsException: Could not load file or assembly 'Elmah' or one of its dependencies. The system cannot find the file specified.]
System.Web.Configuration.ConfigUtil.GetType(String typeName, String propertyName, ConfigurationElement configElement, XmlNode node, Boolean checkAptcaBit, Boolean ignoreCase) +353
System.Web.Configuration.ConfigUtil.GetType(String typeName, String propertyName, ConfigurationElement configElement, Boolean checkAptcaBit) +21
System.Web.Configuration.Common.ModulesEntry.SecureGetType(String typeName, String propertyName, ConfigurationElement configElement) +39
System.Web.Configuration.Common.ModulesEntry..ctor(String name, String typeName, String propertyName, ConfigurationElement configElement) +42
System.Web.HttpApplication.BuildIntegratedModuleCollection(List`1 moduleList) +160
System.Web.HttpApplication.GetModuleCollection(IntPtr appContext) +1068
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +82
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +336
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296
[HttpException (0x80004005): Could not load file or assembly 'Elmah' or one of its dependencies. The system cannot find the file specified.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +10037820
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254
Web.config
.csproj
Seems IIS configs were corrupted. I deleted the site and it works fine now. I'm really confused how the file got corrupted however. It was fine when I left the office yesterday.
It has to do with working between different branches of the same project but I can't really say exactly what caused it.
Related
I have "WCF Service Application" which is .net framework 4.6.1. I need to add "Interop.zkemkeeper.dll" as a reference. but when I added this as reference to the WCF service and when service stated it shows following error on the browser.
"Server Error in '/' Application.
Could not load file or assembly 'Interop.zkemkeeper' or one of its dependencies. An attempt was made to load a program with an incorrect format.
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.BadImageFormatException: Could not load file or assembly 'Interop.zkemkeeper' or one of its dependencies. An attempt was made to load a program with an incorrect format.
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 'Interop.zkemkeeper' could not be loaded.
=== Pre-bind state information ===
LOG: DisplayName = Interop.zkemkeeper
(Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: Interop.zkemkeeper | Domain ID: 2
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///C:/Users/Dushmantha/source/repos/VFTService/VFTService/
LOG: Initial PrivatePath = C:\Users\Dushmantha\source\repos\VFTService\VFTService\bin
Calling assembly : (Unknown).
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\Dushmantha\source\repos\VFTService\VFTService\web.config
LOG: Using host configuration file: C:\Users\Dushmantha\Documents\IISExpress\config\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Users/Dushmantha/AppData/Local/Temp/Temporary ASP.NET Files/vs/224635a0/d24b75c0/Interop.zkemkeeper.DLL.
LOG: Attempting download of new URL file:///C:/Users/Dushmantha/AppData/Local/Temp/Temporary ASP.NET Files/vs/224635a0/d24b75c0/Interop.zkemkeeper/Interop.zkemkeeper.DLL.
LOG: Attempting download of new URL file:///C:/Users/Dushmantha/source/repos/VFTService/VFTService/bin/Interop.zkemkeeper.DLL.
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.
Stack Trace:
[BadImageFormatException: Could not load file or assembly 'Interop.zkemkeeper' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +36
System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +152
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +77
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +21
System.Reflection.Assembly.Load(String assemblyString) +28
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +38
[ConfigurationErrorsException: Could not load file or assembly 'Interop.zkemkeeper' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +738
System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +217
System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +130
System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +170
System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +92
System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +290
System.Web.Compilation.BuildManager.ExecutePreAppStart() +157
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +549
[HttpException (0x80004005): Could not load file or assembly 'Interop.zkemkeeper' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +10075108
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +95
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254"
Could you try change Platform target to x86?
Click Build button on the toolbar
Click Configuration Manager
Then set Plataform target to x86
i've installed glimpse through console package manager by this
Install-Package Glimpse.EF6
Glimpse.EF6/1.6.5 is installed on system and added in preferences.
following 'http://getglimpse.com/Docs/' tutorial, when i try to access http://mylocalhost/Glimpse.axd it shows me error
"HTTP Error 404.0 - Not Found
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable."
searched for the solution and found something here.
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
this line is already there app-start. tried to add keys in web.config but that shows error
"Server Error in '/' Application.
Runtime Error
Description: An exception occurred while processing your request. Additionally, another exception occurred while executing the custom error page for the first exception. The request has been terminated. "
using IIS express. any help will be appreciated.
EDIT: i turned off the custom errors and found this is the actual problem when i try to add those lines in web.config.
"Server Error in '/' Application.
Could not load type 'Glimpse.Core.Module' from assembly 'Glimpse.Core'.
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.TypeLoadException: Could not load type 'Glimpse.Core.Module' from assembly 'Glimpse.Core'.
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:
[TypeLoadException: Could not load type 'Glimpse.Core.Module' from assembly 'Glimpse.Core'.]
System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName, ObjectHandleOnStack type) +0
System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName) +70
System.RuntimeType.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark) +39
System.Type.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase) +37
System.Web.Compilation.BuildManager.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase) +65
System.Web.Configuration.ConfigUtil.GetType(String typeName, String propertyName, ConfigurationElement configElement, XmlNode node, Boolean checkAptcaBit, Boolean ignoreCase) +38
[ConfigurationErrorsException: Could not load type 'Glimpse.Core.Module' from assembly 'Glimpse.Core'.]
System.Web.Configuration.ConfigUtil.GetType(String typeName, String propertyName, ConfigurationElement configElement, XmlNode node, Boolean checkAptcaBit, Boolean ignoreCase) +348
System.Web.Configuration.ConfigUtil.GetType(String typeName, String propertyName, ConfigurationElement configElement, Boolean checkAptcaBit) +19
System.Web.Configuration.Common.ModulesEntry.SecureGetType(String typeName, String propertyName, ConfigurationElement configElement) +39
System.Web.Configuration.Common.ModulesEntry..ctor(String name, String typeName, String propertyName, ConfigurationElement configElement) +42
System.Web.HttpApplication.BuildIntegratedModuleCollection(List`1 moduleList) +158
System.Web.HttpApplication.GetModuleCollection(IntPtr appContext) +950
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +82
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +336
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296
[HttpException (0x80004005): Could not load type 'Glimpse.Core.Module' from assembly 'Glimpse.Core'.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9955652
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254"
alright the glimpse.EF6 was not working so i un-installed it and installed glipmse.mvc5 and it worked like a charm.
I have tried looking at previous threads with none of them helping me. I am trying to get into web dev with C# asp.net (MVC5) but when trying to run the standard template website I get an error. In Chrome and IE, I have also tried creating new projects. Here are the errors I am recieving:
Could not load file or assembly 'System.Web.WebPages.Deployment, 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)
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.WebPages.Deployment, 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)
=== Pre-bind state information ===
LOG: DisplayName = System.Web.WebPages.Deployment, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
(Fully-specified)
LOG: Appbase = file:///c:/users/chris/documents/visual studio 2013/Projects/WebApplication3/WebApplication3/
LOG: Initial PrivatePath = c:\users\chris\documents\visual studio 2013\Projects\WebApplication3\WebApplication3\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: c:\users\chris\documents\visual studio 2013\Projects\WebApplication3\WebApplication3\web.config
LOG: Using host configuration file: C:\Users\Chris\Documents\IISExpress\config\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: System.Web.WebPages.Deployment, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: Attempting download of new URL file:///C:/Users/Chris/AppData/Local/Temp/Temporary ASP.NET Files/root/710eb268/4f51e2d0/System.Web.WebPages.Deployment.DLL.
LOG: Attempting download of new URL file:///C:/Users/Chris/AppData/Local/Temp/Temporary ASP.NET Files/root/710eb268/4f51e2d0/System.Web.WebPages.Deployment/System.Web.WebPages.Deployment.DLL.
LOG: Attempting download of new URL file:///c:/users/chris/documents/visual studio 2013/Projects/WebApplication3/WebApplication3/bin/System.Web.WebPages.Deployment.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Major Version
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
Stack Trace:
[FileLoadException: Could not load file or assembly 'System.Web.WebPages.Deployment, 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)]
System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +34
System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +152
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +77
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +16
System.Reflection.Assembly.Load(String assemblyString) +28
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +38
[ConfigurationErrorsException: Could not load file or assembly 'System.Web.WebPages.Deployment, 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)]
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +752
System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +57
System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +170
System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +91
System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +285
System.Web.Compilation.BuildManager.ExecutePreAppStart() +153
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +516
[HttpException (0x80004005): Could not load file or assembly 'System.Web.WebPages.Deployment, 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)]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9913572
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254
Re-installed and all is good now, 2 hours of my life wasted!
There are lots of questions answering this, but none of the answers are working for me.
Originally, I was getting a 405 when I was trying to PUT or DELETE (probably other verbs too). Looking at some questions, the solution seemed to be to change the Handler Mappings.
I changed the following:
ExtensionlessUrlHandler-ISAPI-4.0_32bit
ExtensionlessUrlHandler-ISAPI-4.0_64bit
WebDAV
I noticed that the verbs were already in the One of the following verbs box, so in desperation I changed it to accept all verbs.
Now, I can't even load the webpage, let alone make any exotic requests like a DELETE, I immediately get a yellow screen of death:
Server Error in '/' Application.
Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
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.TypeLoadException: Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
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:
[TypeLoadException: Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.]
System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName, ObjectHandleOnStack type) +0
System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName) +153
System.Type.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase) +100
System.Web.Compilation.BuildManager.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase) +124
System.Web.Configuration.ConfigUtil.GetType(String typeName, String propertyName, ConfigurationElement configElement, XmlNode node, Boolean checkAptcaBit, Boolean ignoreCase) +76
[ConfigurationErrorsException: Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.]
System.Web.Configuration.ConfigUtil.GetType(String typeName, String propertyName, ConfigurationElement configElement, XmlNode node, Boolean checkAptcaBit, Boolean ignoreCase) +12687536
System.Web.Configuration.Common.ModulesEntry.SecureGetType(String typeName, String propertyName, ConfigurationElement configElement) +69
System.Web.Configuration.Common.ModulesEntry..ctor(String name, String typeName, String propertyName, ConfigurationElement configElement) +66
System.Web.HttpApplication.BuildIntegratedModuleCollection(List`1 moduleList) +300
System.Web.HttpApplication.GetModuleCollection(IntPtr appContext) +1262
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +133
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +304
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +404
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +475
[HttpException (0x80004005): Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +12881108
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +12722297
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18045
So far I have:
Checked ASP.NET 4.5 is installed via Web PI
Running dism /online /enable-feature /featurename:IIS-ASPNET45
Running "%WINDIR%\Microsoft.Net\Framework\v3.0\Windows Communication Foundation\ServiceModelReg.exe" -r
Running C:\Windows\Microsoft.NET\Framework64\v4.0.30319>aspnet_regiis -I
More iisresets than I can could
Replacing the ServiceModel in the applicationHost.config:
<add name="ServiceModel" type="System.ServiceModel.Activation.HttpModule, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="managedHandler" />
replaced with:
<add name="ServiceModel" type="System.ServiceModel.Activation.HttpModule, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="managedHandler,runtimeVersionv4.0" />
What else can I do, or where should I be looking?
Thanks
Dave
you also have to activate servicemodel 4.0 with
dism /online /enable-Feature /all /FeatureName:WCF-HTTP-Activation45
and in de IIS manager (server -> feature -> modules)
check if you see servicemodel 4.0 and then remove servicemodel.
I had the same problem after installing Synfusion Essential Studio on my computer.
I resolved by performing the following steps:
Open IIS Manager console
On the Server panel go to Modules, features view
Make sure ServiceModule-4.0 is there. If it's not there, perform the steps prescribed above (1-6)
Remove ServiceModel module
Just thought this might help someone.
This error can occur when there are multiple versions of the .NET Framework on the computer that is running IIS, and IIS was installed after .NET Framework 4.0 or before the Service Model in Windows Communication Foundation was registered.
here is the link to resolve this.
http://msdn.microsoft.com/en-us/library/hh169179%28v=nav.71%29.aspx
This link works for me.
http://www.codeproject.com/Articles/613812/Solve-IIS-Error-Could-not-load-type-System-Servi
You have to remove the ServerModel module and the svc-integrated handler.
Adding this to my application's web.config worked for me:
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<add name="ServiceModel-4.0" type="System.ServiceModel.Activation.ServiceHttpModule, System.ServiceModel.Activation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" preCondition="managedHandler" />
</modules>
</system.webServer>
I want to instantiate a class at runtime using
_syncHelper = (ISyncHelper) Activator.CreateInstance("SBD.Syrius.Synchronisation", "SyncHelper");
A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll
System.IO.FileNotFoundException: Could not load file or assembly
'SBD.Syrius.Synchronisation' or one of its dependencies. The system cannot find the file specified.
File name: 'SBD.Syrius.Synchronisation'
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase,
Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Activator.CreateInstance(String assemblyString, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(String assemblyName, String typeName)
at SBD.Syrius.DataLayer.DataHelper.get_SyncHelper() in e:\EShared\Syrius6\syrius_syrius\SBD.Syrius.DataLayer\DataHelper.cs:line 35
at SBD.Syrius.DataLayer.Context.SaveChanges() in e:\EShared\Syrius6\syrius_syrius\SBD.Syrius.DataLayer\Context.cs:line 99
at SBD.Syrius.UI.MDIHelper.AttemptToSave(Context Db) in e:\EShared\Syrius6\syrius_syrius\SBD.Syrius.UI\MDIHelper.cs:line 51
=== Pre-bind state information ===
LOG: User = saturn\kirsten
LOG: DisplayName = SBD.Syrius.Synchronisation
(Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: SBD.Syrius.Synchronisation | Domain ID: 1
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information
and common solutions to this issue.
LOG: Appbase = file:///E:/EShared/Syrius6/syrius_syrius/SBD.Syrius.UI/bin/Debug/
LOG: Initial PrivatePath = NULL
Calling assembly : SBD.Syrius.DataLayer, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file:
E:\EShared\Syrius6\syrius_syrius\SBD.Syrius.UI\bin\Debug\SBD.Syrius.UI.vshost.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from
C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or
location-based assembly bind).
LOG: Attempting download of new URL file:///E:/EShared/Syrius6/syrius_syrius/SBD.Syrius.UI/bin/Debug/SBD.Syrius.Synchronisation.DLL.
LOG: Attempting download of new URL file:///E:/EShared/Syrius6/syrius_syrius/SBD.Syrius.UI/bin/Debug/SBD.Syrius.Synchronisation/SBD.Syrius.Synchronisation.DLL.
LOG: Attempting download of new URL file:///E:/EShared/Syrius6/syrius_syrius/SBD.Syrius.UI/bin/Debug/SBD.Syrius.Synchronisation.EXE.
LOG: Attempting download of new URL file:///E:/EShared/Syrius6/syrius_syrius/SBD.Syrius.UI/bin/Debug/SBD.Syrius.Synchronisation/ SBD.Syrius.Synchronisation.EXE.
The error I receive contains a link to MSDN here, but I cannot find an example of how to specify textual identity for the assembly.
I note that the full error indicates that it is looking int the wrong folder and also for a file with an uppercase .DLL . My file is creating with a lowercase .dll
Is there an example of how to provide a fully specified textual identity for an assembly?
Should I be trying to change the case of the .dll extension?
If I actually copy the .dll to the UI\bin\debug folder then I get a different error
A first chance exception of type 'System.TypeLoadException' occurred in mscorlib.dll
System.TypeLoadException: Could not load type 'SyncHelper'
from assembly
'SBD.Syrius.Synchronisation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
at System.Reflection.RuntimeAssembly.GetType(RuntimeAssembly assembly, String name,
Boolean throwOnError, Boolean ignoreCase, ObjectHandleOnStack type)
at System.Reflection.RuntimeAssembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase)
at System.Activator.CreateInstance(String assemblyString, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(String assemblyName, String typeName)
at SBD.Syrius.DataLayer.DataHelper.get_SyncHelper() in
e:\EShared\Syrius6\syrius_syrius\SBD.Syrius.DataLayer\DataHelper.cs:line 35
at SBD.Syrius.DataLayer.Context.SaveChanges() in
e:\EShared\Syrius6\syrius_syrius\SBD.Syrius.DataLayer\Context.cs:line 99
at SBD.Syrius.UI.MDIHelper.AttemptToSave(Context Db) in
e:\EShared\Syrius6\syrius_syrius\SBD.Syrius.UI\MDIHelper.cs:line 51
Spot three errors:
Activator.CreateInstance needs the complete name of type to load it
it means that you must add namespace to the type name.
Chances are you have more than one class with that name in different namespaces then how it could figure out which one be loaded.
You want to create an instance of an Interface which is impossible.
ISyncHelper is an interface and you can not say:
var variable = new ISynchHelper()
It will cause compilation error, cause interfaces are just empty bodies and does not contain single line of implementation.
So evertime that you use reflection to do smething, be careful, cause the compiler can not help you and if something is supposed to go wrong, you'll face it in runtime, not in compile time.
Last error is due to that there is no reference to Synchronization project in UI which means that it will not copied to Bin folder of UI project.
You can do that by adding the Synchronization project to UI or just add a copy command to Synchronization project to be copied after build.
Good Luck :-)