设置DLL的常规应用程序路径并避免无法加载类型'< project>。< class>'错误 [英] setting up general app path for DLLs and avoiding Could not load type '<project>.<class>' error

查看:59
本文介绍了设置DLL的常规应用程序路径并避免无法加载类型'< project>。< class>'错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不确定这是否是一个专家问题,但我确信他们

就在那里。


我会的喜欢在我的Win2003.Net上设置一般应用程序或bin目录

服务器,它将保存一些有用的工具,使该服务器上的更多页面可以使用


作为一个例子,我创建了一个Page Counter类,它打开一个Access .mdb

文件,计算该页面的当前条目,并添加一个带有
$的新条目b $ b有关当前请求的一些信息。该计数器在它开发的同一页面上非常有用,只要bin目录

与DLL就位于该路径下方。


现在,我想做的是在我的

Win2003.Net服务器上设置常规bin或app direcotry,我可以将counter.dll移动到想要使用该计数器的所有

页面都可以参考。我假设,要实现这一目标至少需要两步才能完成。

1)在Win2003.Net服务器上设置应用程序路径并以某种方式''发布''

所有页面的应用程序路径

2)修改.aspx文件的第一行以引用该目录或

从其他地方加载它然后默认/ bin。


<%@ Page Language =" vb" AutoEventWireup =" false"
Codebehind =" CounterPage.aspx.vb" Inherits =" Counter.CounterPage"%>

如何修改该行以引用其他目录然后是本地/ bin?


3)是否需要对Web.config进行修改,是否必须将

放在每个页面的路径中?

我非常感谢您的帮助和帮助描述了实现这一目标所需的步骤。


谢谢,

沃尔夫冈

I am not sure if this is more of an expert question, but I am sure that they
are out there.

I''d like to setup a general application or bin directory on my Win2003.Net
Server that will hold some useful utils that more pages on that server can
use.
As an example, I have created a Page Counter class that opens an Access .mdb
file, counts the current entries for that page, and adds a new entry with
some information regarding the current request. That counter works great on
that same page it has been developed for and as long as the bin directory
with the DLL sits right beneath that path.

Now, what I''d like to do is to setup a general bin or app direcotry on my
Win2003.Net Server where I can move that counter.dll to and to which all the
pages that want to use that counter can refer to. I assume, that there would
be at least 2 steps necessary to accomplish that.
1) setting up an app path on the Win2003.Net Server and somehow ''publishing''
that app path for all the pages
2) modifying the first line of the .aspx file to refer to that directory or
load it from somewhere else then the default /bin.

<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="CounterPage.aspx.vb" Inherits="Counter.CounterPage"%>
How to modify that line to refer to some other directory then the local/bin?

3) Are there modifications to Web.config necessary, and does it have to be
placed in every single page''s path?
I''d really appreciate your help and describing the steps necessary to
accomplish that.

Thanks,
Wolfgang

推荐答案




如何使用GAC。你可以在那里注册你的实用程序DLL和

从服务器上的每个应用程序调用它们。

Natty Gur [MVP]


博客: http://weblogs.asp.net/ngur

手机:+ 972-(0)58-888377

***通过Developersdex发送 http://www.developersdex.com ***

不要只是参加USENET ......获得奖励!
Hi,

what about using the GAC. you can register your Utility DLLs there and
call them from each and every apllication on the server.
Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!


HI Wolfgang,


目前。据我所知,你想创建一个DLL,可以用作多个ASP.NET应用程序的代码隐藏。但是,在ASP.NET

应用程序中,DLL文件必须放在其单独的BIN文件夹中。

我们无法将其设置为另一个文件夹。 />

关于这个问题,我认为应该有两个解决方法:


1.正如Natty建议的那样,创建一个名字很强的库程序集它是GAC的
。然后,您可以从任何ASP.NET应用程序访问它。对于.NET

GAC,您可以参考:

http://support.microsoft.com/default...;EN-US;Q315682

如何:在Visual Basic中的全局程序集缓存中安装程序集

NET

2.为页计数器功能创建ASP.NET Web用户控件并使用

您需要的每个页面中的此控件。通过这种方式,Web Usercontrol'的dll

文件将被添加到本地BIN文件夹中。


希望这个帮助,


Luke

Microsoft在线支持


安全! www.microsoft.com/security

(此帖子按原样提供,不作任何保证,并且不授予

权利。)

HI Wolfgang,

Thank you for using MSDN Newsgroup. I am Luke and I am review this issue
currently. As I understand, you want to create a DLL which can be used as
codebehind by multiple ASP.NET application. However, in ASP.NET
application, the DLL files have to be placed in its individual BIN folder.
we can''t set it to another folder.

Regarding the problem, I think there should be two work around:

1. As Natty suggest, create a library assembly with strong name and put it
into GAC. Then you can access it from any of ASP.NET appliaction. For .NET
GAC, you may refer to:

http://support.microsoft.com/default...;EN-US;Q315682
How To: Install an Assembly in the Global Assembly Cache in Visual Basic
NET

2. Create a ASP.NET Web Usercontrol for the page counter function and use
this control in every page you need. In this way, Web Usercontrol''s dll
file will be added in to the local BIN folder.

Hope this help,

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


Luke,

感谢您的帮助。我能够使用SN工具创建加密密钥对

,将其添加到AssemblyInfo.vb文件并生成我添加到GAC的DLL

。 br />
但是,我仍然收到错误消息:

解析错误消息:无法加载类型''Counter.CounterPage''


VB.NET中的项目称为Counter,我创建的类是

CounterPage。


我更改了顶部我的aspx文件中的行是:

<%@ Page Language =" vb" AutoEventWireup =" false"

Inherits =" Counter.CounterPage"%>


为什么我仍然会收到Parse错误消息?


谢谢,

Wolfgang

" MSFT" <卢****** @ online.microsoft.com>在消息中写道

新闻:hL ************* @ cpmsftngxa07.phx.gbl ...
Luke,

Thank you for your help. I was able to create the cryptographic key pair
with the SN tool, add that to the AssemblyInfo.vb file and generate a DLL
that I added to the GAC.
However, I am still getting the error message:
Parse Error Message: Could not load type ''Counter.CounterPage''

The project in VB.NET is called "Counter", and the class I created is
"CounterPage".

I changed the top line in my aspx file to be:
<%@ Page Language="vb" AutoEventWireup="false"
Inherits="Counter.CounterPage"%>

Why would I still get the Parse Error Message?

Thank you,
Wolfgang
"MSFT" <lu******@online.microsoft.com> wrote in message
news:hL*************@cpmsftngxa07.phx.gbl...
HI Wolfgang,
感谢您使用MSDN新闻组。我是卢克,我正在审查这个问题
目前。据我所知,你想创建一个DLL,可以被多个ASP.NET应用程序用作代码隐藏。但是,在ASP.NET
应用程序中,DLL文件必须放在其各自的BIN文件夹中。
我们不能将其设置为另一个文件夹。

关于问题,我认为应该有两个工作:

1.正如Natty建议的那样,创建一个具有强名称的库程序集并将其放入GAC。然后,您可以从任何ASP.NET应用程序访问它。对于.NET
GAC,您可以参考:

http://support.microsoft.com/default...;EN-US;Q315682
如何:在全局程序集中安装程序集在Visual Basic中缓存

2.为页面计数器功能创建一个ASP.NET Web Usercontrol,并在您需要的每个页面中使用
。通过这种方式,Web Usercontrol'的dll
文件将被添加到本地BIN文件夹中。

希望这个帮助,

卢克
Microsoft在线支持

获得安全! www.microsoft.com/security
(此帖已提供按原样,没有保证,也没有赋予
权利。)
HI Wolfgang,

Thank you for using MSDN Newsgroup. I am Luke and I am review this issue
currently. As I understand, you want to create a DLL which can be used as
codebehind by multiple ASP.NET application. However, in ASP.NET
application, the DLL files have to be placed in its individual BIN folder.
we can''t set it to another folder.

Regarding the problem, I think there should be two work around:

1. As Natty suggest, create a library assembly with strong name and put it
into GAC. Then you can access it from any of ASP.NET appliaction. For .NET
GAC, you may refer to:

http://support.microsoft.com/default...;EN-US;Q315682
How To: Install an Assembly in the Global Assembly Cache in Visual Basic
NET

2. Create a ASP.NET Web Usercontrol for the page counter function and use
this control in every page you need. In this way, Web Usercontrol''s dll
file will be added in to the local BIN folder.

Hope this help,

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)



这篇关于设置DLL的常规应用程序路径并避免无法加载类型'&lt; project&gt;。&lt; class&gt;'错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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