मेरे पास कई लाइब्रेरी प्रोजेक्ट्स सहित विजुअल स्टूडियो 2013 में एक वेब प्रोजेक्ट है।.NET 4.6 वेबसाइट संदर्भ असेंबली को सही ढंग से लोड नहीं कर रही है
समस्या यह है कि वेब प्रोजेक्ट में एक संदर्भ (यानी सिस्टम। कोलेक्शन, सिस्टम.Net) जोड़ना C:\Program Files (x86)\Reference Assemblies\Microsoft
से 'रेफरेंस असेंबली' के रूप में जोड़ा जा रहा है, जब आईआईएस में लोड किया गया है तो यह सही ढंग से कार्यान्वयन को लोड नहीं कर रहा है असेंबली (जीएसी से)। उदाहरण त्रुटि निम्नानुसार है।
[BadImageFormatException: Cannot load a reference assembly for execution.]
[BadImageFormatException: Could not load file or assembly 'System.Collections' or one of its dependencies. Reference assemblies should not be loaded for execution. They can only be loaded in the Reflection-only loader context. (Exception from HRESULT: 0x80131058)]
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.Collections' or one of its dependencies. Reference assemblies should not be loaded for execution. They can only be loaded in the Reflection-only loader context. (Exception from HRESULT: 0x80131058)]
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +728
System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +196
System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +45
System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +172
System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +91
System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +111
System.Web.Compilation.BuildManager.ExecutePreAppStart() +156
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +624
[HttpException (0x80004005): Could not load file or assembly 'System.Collections' or one of its dependencies. Reference assemblies should not be loaded for execution. They can only be loaded in the Reflection-only loader context. (Exception from HRESULT: 0x80131058)]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +659
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +95
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +189
बिन फ़ोल्डर से संदर्भ DLLs हटाया जा रहा है समस्या ठीक होती है, लेकिन मुझे यकीन है कि क्या ठीक से इस को ठीक किए की जरूरत नहीं हूँ।
उत्तर अपडेट किया गया [नीचे] –
मुझे वास्तव में पता चल सकता है कि आपकी समस्या क्या है: आपको 'System.Collections' के संदर्भ में 'स्थानीय = सही' कॉपी करें' की जांच करनी होगी। और अब आपके पास बिन और अन्य स्थानों में है। आपकी वेबसाइट बिन में एक संकलित करने की कोशिश करती है। तो, नीचे दिए गए उत्तर का जवाब इसे '<हटाएं असेंबली>' के साथ ठीक कर सकता है। लेकिन सही फिक्स 'स्थानीय = झूठी कॉपी करें' सेट करना होगा। आप आम तौर पर किसी भी 'सिस्टम' * असेंबली स्थानीय प्रतिलिपि नहीं करना चाहते हैं। –
@ टीएस। अच्छा विचार, मैंने सभी परियोजनाओं की जांच की है और स्थानीय – Sam