Web.config中system.webserver错误 [英] Web.config system.webserver errors

查看:276
本文介绍了Web.config中system.webserver错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想我的C#ASP.Net应用程序部署到我的托管网站。现在的问题是我有一个应用程序使用,但共享主机,他们不能在bin文件夹2 C ++动态链接库。他们已经在项目中所引用的FOM一个名为bin_native文件夹。该应用程序在我的机器上运行,用在web.config和装配指令的运行部分探测privatePath我Default.aspx文件的顶部。但它不会像在服务器上运行。在该文件的顶部在2大会指令解析的Default.aspx当网站加载时,有错误就不能找到的DLL。

I'm trying to deploy my C# ASP.Net app to my hosting site. The problem is I have 2 C++ dlls that the app uses, but with shared hosting they can't be in the bin folder. They've been referenced in the project fom a folder called 'bin_native'. The app runs on my machine with using the probing privatePath in the runtime section of the web.config and Assembly directives at the top of my Default.aspx file. But it won't run on the server like that. It can't find the dlls when parsing the default.aspx when the site loads, with an error at the 2 Assembly directives at the top of that file.

所以,我想引用添加到dll文件在web.config的system.webserver部分。对于现场支持说,如果我能做到这一点,也许应用程序可以使用位于我的网站的父目录的wwwroot文件夹(ASP.Net bin文件夹是)一个单独的bin文件夹。这样,应用程序可以找到的DLL。

So I'm trying to add references to the dlls in the system.webserver section of the web.config. Support for the site said if I can do that maybe the app can use a separate bin folder that is located in the parent directory of my sites wwwroot folder (where the ASP.Net bin folder is). That way the app can find the dlls.

但我不能得到system.webserver部分没有错误是正确的。当我在我的机器上测试,我得到以下错误:

But I can't get the system.webserver section correct without errors. When I test on my machine I get the following error:

Server Error in '/' Application.

Could not load file or assembly 'find_duplicates, Version=0.0.0.0, Culture=neutral, PublicKeyToken=e02ee5289fcc8248' 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 'find_duplicates, Version=0.0.0.0, Culture=neutral, PublicKeyToken=e02ee5289fcc8248' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

下面是迄今为止我所做的更改在我的项目:

Here are the changes in my project I've made so far:

Default.aspx的:

Default.aspx:

<%@ Assembly Name="find_duplicates" %>
<%@ Assembly Name="trim_combos" %>

Web.config文件:

Web.config:

 <system.webServer>

    <modules runAllManagedModulesForAllRequests="true">

     <add name="find_duplicates" type="find_dups.find_duplicates, find_duplicates,Version=0.0.0.0, Culture=neutral, PublicKeyToken=e02ee5289fcc8248"  />

      <add name="trim_combos" type="trim_coms.trim_combos, trim_combos, Version=0.0.0.0, Culture=neutral, PublicKeyToken=e02ee5289fcc8248"  />

     </modules>

    <validation validateIntegratedModeConfiguration="false" />

  </system.webServer>

 <runtime>  

    <dependentAssembly>

       <assemblyIdentity name="find_dups.find_duplicates.find_duplicates" publicKeyToken="e02ee5289fcc8248" culture="neutral" />

    </dependentAssembly>

    <dependentAssembly>

        <assemblyIdentity name="trim_coms.trim_combos.trim_combos" publicKeyToken="e02ee5289fcc8248" culture="neutral" />

    </dependentAssembly> 



   <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

        <probing privatePath="bin_native"/>

   </assemblyBinding>

</runtime>

我的DLL是在头文件中定义为:

My dlls are defined in the header files as:

find_duplicates dll

namespace   find_dups
class       find_duplicates

trim_combos   dll

namespace   trim_coms
class       trim_combos

我在Windows 7集成管道模式的64位运行IIS。这就是为什么我使用的system.webserver部分而不是在web.config中system.web节的。

I'm on Windows 7 64 bit running IIS in Integrated Pipeline mode. That's why I'm using the system.webserver section instead of the the system.web section in the web.config.

任何帮助,这将大大AP preciated。先谢谢了。

Any help with this would be greatly appreciated. Thanks in advance.

推荐答案

我得到它的工作。我的DLL是没有管理的(他们是本机模块),所以它无法加载类型对他们来说,即使他们有一类和命名空间。显然,对于本机模块你只需要使用附加的名字,没有别的,如下:

I got it to work. My dlls are not managed (they're native modules) so it couldn't load the types for them, even though they had a class and a namespace. Apparently for native modules you just use the add name, with nothing else, as follows:

<system.webServer>

    <globalModules>

      <add name="find_duplicates"/>

    </globalModules>

  </system.webServer>

这篇关于Web.config中system.webserver错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆