共享主机 - 网站 - 如何让应用程序找到dll

时间:2014-12-06 14:35:33

标签: asp.net dll

我在共享主机网站上运行ASP.Net应用程序。该应用程序使用我创建的2个dll。但是,如果我将dll放在网站根bin文件夹中,该网站将无法加载。如果我把它们放在其他任何地方,应用程序找不到dll。该应用程序在我的电脑上本地运行与bin文件夹中的dll。我将dll的引用添加到我的项目中,并选择将本地复制设置为true。我联系了网站的支持,他们说把dll放在根目录(wwwroot)之外的新bin文件夹中,我做了。说明还说要编辑带有某些新增功能的web.config文件,我试过,但是我在新的web.config文件中找到了错误的模块类型错误。

如果我从wwwroot / bin文件夹中恢复dll,则出现以下错误:

Server Error in '/' Application.

Unable to load DLL 'trim_combos.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

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.DllNotFoundException: Unable to load DLL 'trim_combos.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

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: 


[DllNotFoundException: Unable to load DLL 'trim_combos.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)]
   Powerball.trim(Int32[,] array, Int32 total, Int32 match) +0
   Powerball.combos_2() +26
   Lottery_C_Sharp_ASP._Default.Button15_Click(Object sender, EventArgs e) +86
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +9628114
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +103
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +35
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1724

如果我把dll放在wwwroot / bin文件夹中,我会收到以下错误:

Server Error in '/' Application.

Could not load file or assembly 'find_duplicates.DLL' or one of its dependencies. The specified module could not be found.

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 'find_duplicates.DLL' or one of its dependencies. The specified module could not be found.

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: 


[FileNotFoundException: Could not load file or assembly 'find_duplicates.DLL' or one of its dependencies. The specified module could not be found.]
   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 'find_duplicates.DLL' or one of its dependencies. The specified module could not be found.]
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +736
   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() +91
   System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +284
   System.Web.Compilation.BuildManager.ExecutePreAppStart() +153
   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +521

[HttpException (0x80004005): Could not load file or assembly 'find_duplicates.DLL' or one of its dependencies. The specified module could not be found.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9930568
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254

以下是他们支持我如何编辑web.config的示例。我想如果我可以得到一些正确的帮助,没有错误可以解决问题。即要使用的模块类型:

<configuration>

<configSections>
<section name=”MODULE”
type=”MODULE_TYPE, DLL_NAME” />
</configSections>

<system.web>
<httpModules>
<add name=”MODULE” type=”MODULE_TYPE, DLL_NAME” />
</httpModules>
</system.web>

<system.webServer>
<modules runAllManagedModulesForAllRequests=”true”>
<add name=”MODULE” type=”MODULE_TYPE” />
</modules>
<validation validateIntegratedModeConfiguration=”false” />
</system.webServer>

</configuration>

0 个答案:

没有答案