Visual Studio Azure云服务项目提供运行时错误

时间:2016-06-06 07:06:16

标签: asp.net .net visual-studio

我创建了一个新的Azure Cloud服务项目'AzureCloudService1',并向其添加了一个MVC webrole 'WebRole1'。对于Debug和Release,我将'WebRole1'的配置更改为x64而不是AnyCPU。由于某种原因,Visual Studio不允许我将'AzureCloudService1'的配置更改为x64。因此,它仍然是AnyCPU。我必须进行此配置更改,因为我要安装的nuget包需要x64 config。

然后,我安装了nuget包。 nuget包有Microsoft.Cis.Monitoring.Query.dll作为其DLL之一。包中还有许多其他DLL。在浏览器中运行解决方案后,它引发了运行时错误。浏览器上显示的错误如下所示。如果我将解决方案的“参考”部分中的Copy Local Microsoft.Cis.Monitoring.Query.dll属性更改为false,则此错误消失,项目运行正常。谁能告诉我,这里有什么问题?

浏览器中显示的运行时错误: -

Could not load file or assembly 'Microsoft.Cis.Monitoring.Query' 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 'Microsoft.Cis.Monitoring.Query' 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 'Microsoft.Cis.Monitoring.Query' could not be loaded.



=== Pre-bind state information ===
LOG: DisplayName = Microsoft.Cis.Monitoring.Query
 (Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: Microsoft.Cis.Monitoring.Query | 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/avinash/documents/visual studio 2015/Projects/AzureCloudService1/WebRole1/
LOG: Initial PrivatePath = c:\users\avinash\documents\visual studio 2015\Projects\AzureCloudService1\WebRole1\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: c:\users\avinash\documents\visual studio 2015\Projects\AzureCloudService1\WebRole1\web.config
LOG: Using host configuration file: C:\Users\avinash\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/root/51e5fcdf/580d0562/Microsoft.Cis.Monitoring.Query.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/51e5fcdf/580d0562/Microsoft.Cis.Monitoring.Query/Microsoft.Cis.Monitoring.Query.DLL.
LOG: Attempting download of new URL file:///c:/users/avinash/documents/visual studio 2015/Projects/AzureCloudService1/WebRole1/bin/Microsoft.Cis.Monitoring.Query.DLL.
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.



Stack Trace: 



[BadImageFormatException: Could not load file or assembly 'Microsoft.Cis.Monitoring.Query' 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 'Microsoft.Cis.Monitoring.Query' 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) +531

[HttpException (0x80004005): Could not load file or assembly 'Microsoft.Cis.Monitoring.Query' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9946024
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +90
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +261

0 个答案:

没有答案