asp.net使用自己开发的公共组件发布问题。

蝈蝈俊 2003-05-20 09:21:17
自己开发了一个公共组件CSDNFunction,把它发布到应用程序缓存中(gacutil /i)
但是发布机子上执行asp.net程序,会报下面错误。

Server Error in '/member' Application.
--------------------------------------------------------------------------------

File or assembly name CSDNFunction, or one of its dependencies, was not 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: File or assembly name CSDNFunction, or one of its dependencies, was not 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.

Assembly Load Trace: The following information can be helpful to determine why the assembly 'CSDNFunction' could not be loaded.


=== Pre-bind state information ===
LOG: DisplayName = CSDNFunction, Version=1.0.1206.32019, Culture=neutral, PublicKeyToken=64958407e147fc50
(Fully-specified)
LOG: Appbase = file:///E:/web/Csdn.net/member
LOG: Initial PrivatePath = bin
Calling assembly : member, Version=1.0.1206.32521, Culture=neutral, PublicKeyToken=null.
===

LOG: Publisher policy file is not found.
LOG: No redirect found in host configuration file (C:\WINNT\Microsoft.NET\Framework\v1.1.4322\aspnet.config).
LOG: Using machine configuration file from C:\WINNT\Microsoft.NET\Framework\v1.1.4322\config\machine.config.
LOG: Post-policy reference: CSDNFunction, Version=1.0.1206.32019, Culture=neutral, PublicKeyToken=64958407e147fc50
LOG: Attempting download of new URL file:///C:/WINNT/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/member/0aebdf3f/826dabde/CSDNFunction.DLL.
LOG: Attempting download of new URL file:///C:/WINNT/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/member/0aebdf3f/826dabde/CSDNFunction/CSDNFunction.DLL.
LOG: Attempting download of new URL file:///E:/web/Csdn.net/member/bin/CSDNFunction.DLL.
LOG: Attempting download of new URL file:///E:/web/Csdn.net/member/bin/CSDNFunction/CSDNFunction.DLL.
LOG: Attempting download of new URL file:///C:/WINNT/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/member/0aebdf3f/826dabde/CSDNFunction.EXE.
LOG: Attempting download of new URL file:///C:/WINNT/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/member/0aebdf3f/826dabde/CSDNFunction/CSDNFunction.EXE.
LOG: Attempting download of new URL file:///E:/web/Csdn.net/member/bin/CSDNFunction.EXE.
LOG: Attempting download of new URL file:///E:/web/Csdn.net/member/bin/CSDNFunction/CSDNFunction.EXE.



Stack Trace:


[FileNotFoundException: File or assembly name CSDNFunction, or one of its dependencies, was not found.]
member.Test.Page_Load(Object sender, EventArgs e) +0
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.510; ASP.NET Version:1.1.4322.510
...全文
51 18 打赏 收藏 转发到动态 举报
写回复
用AI写文章
18 条回复
切换为时间正序
请发表友善的回复…
发表回复
蝈蝈俊 2003-05-28
  • 打赏
  • 举报
回复
shit 这个问题又出现了。卸载1.1 再重装也不顶用。
蝈蝈俊 2003-05-21
  • 打赏
  • 举报
回复
都不是上面的问题,

我把发布机子上的 .net FramkWork 1.0 1.1 都卸载了,然后从装 1.1

就没有任何问题了。

  • 打赏
  • 举报
回复
To ghj1976(蝈蝈俊.net):
你发布这个组件的时候,组件上加入强名称了吗?
如果你把这个组件发布到GAC(全称是全局程序集高速缓存)中,.net的框架不是根据你的文件名来找你的这个组件的,而是根据你加入的强名称来找你的这个组件。而且,加入GAC的组件(程序集),就是共享程序集。

系统在GAC中确定某个共享程序集,使用下面四个办法:
1. 强名称(Strong Name)
2. 版本号
3. 文化
4. 程序集本身的名称(包括名称空间)

步骤:
一、创建一个Strong Name:
在vs.net的工具下面有个vs.net(vs.net2003)命令提示,打开它,会进入Dos窗口
输入: sn -k csdnkey.snk <br>
会在C:\下生成一个名为csdnkey.snk的密钥文件
把这个文件拷贝到你的工程下的bin目录下(假设为E:/web/Csdn.net/member/bin),然后在你的CSDNFunction类库工程下的
AssemblyInfo.cs文件的最下面的
[assembly:AssemblyKeyFile("")] 改成:
[assembly:AssemblyKeyFile(@"E:/web/Csdn.net/member/bin/csdnkey.snk")]

二、在这个AssemblyInfo.cs下确定你的版本号

然后就可以在vs.net的命令提示状态下把此组件加入到GAC中
gacutil/i CSDNFunction.dll

测试:
使用这个程序集,在vs.net下必须加入引用,加入引用后就可以正常使用了。
timmy3310 2003-05-21
  • 打赏
  • 举报
回复
你注册的时候,是注册的什么地方的DLL?

另外,引用的时候也有问题,你是不是在同一个解决方案中引用项目?这样会有问题,应该按照绝对路径来引用
还有,引用的时候看看有没有Copy Dll到Bin目录下,如果是按照项目来引用,有可能VS.Net会当作私有装配件把它Copy一个副本到你的Bin目录

注册过后重新编译是会有问题的,版本会发生变化,而且VS.Net不会帮你重新注册
蝈蝈俊 2003-05-21
  • 打赏
  • 举报
回复
我的 gac 中没有多个版本, gacutil /l 中没有多余版本, 用dos 查看目录下也没有。
waki 2003-05-21
  • 打赏
  • 举报
回复
是不是你的GAC中存在多个版本?发布时所带的控件版本不对?
webdiyer 2003-05-21
  • 打赏
  • 举报
回复
可恨现在总是无法访问google,如果你能访问的话可以搜索一下,关键字类似 Customer Control gac之类。

--------------------------------
AspNetPager 免费分页控件4.1版发布,欢迎下载使用:http://www.webdiyer.com
蝈蝈俊 2003-05-21
  • 打赏
  • 举报
回复
发布到 gac 那可以只通过复制粘贴??

我是使用 gacutil /i CSDNFunction.dll 这样方式发布到 gac 的。

没修改过 machine.config 或者 web.config

我的开发机子运行没有任何问题,但是发布到另外一个机子上就有问题了。
wnglish 2003-05-20
  • 打赏
  • 举报
回复
关注,组件问题是应该开一个大帖子。。。
webdiyer 2003-05-20
  • 打赏
  • 举报
回复
你是如何把组件发布到gac中的?只是简单的复制粘帖么?我记得好象还要在machine.config还是web.config中做什么设置的,可惜一时找不到那篇文章了!

--------------------------------
AspNetPager 免费分页控件4.1版发布,欢迎下载使用:http://www.webdiyer.com
蝈蝈俊 2003-05-20
  • 打赏
  • 举报
回复
同样的组件,在一个win 应用程序中调用,发布到发布服务器上就没有问题.
蝈蝈俊 2003-05-20
  • 打赏
  • 举报
回复
反汇编,版本也正确呀.
ildasm

.assembly extern CSDNFunction
{
.publickeytoken = (64 95 84 07 E1 47 FC 50 ) // d....G.P
.ver 1:0:1235:27323
}
蝈蝈俊 2003-05-20
  • 打赏
  • 举报
回复
把它发布到应用程序缓存中
就是实现我写的这个组件的使用跟 System 这类已有名称空间内的类的使用一样处理。
蝈蝈俊 2003-05-20
  • 打赏
  • 举报
回复
英文的标准说法是 发布到 gac
Add an Assembly to the Assembly Cache

不是工程引用.

如何发布看 gacutil 命令
xiongliang2003 2003-05-20
  • 打赏
  • 举报
回复
不好意思,能问下 “把它发布到应用程序缓存中”是什么意思?

你的那个旧的组件工程是不是包括在整个解决方案中的?然后asp.net工程是引用那个组件工程的?
蝈蝈俊 2003-05-20
  • 打赏
  • 举报
回复
组件从新编译了一下,就报组件版本不对了,但是开发服务器\发布服务器两个我都查了,都是那个最新版本的组件呀.
Server Error in '/' Application.
--------------------------------------------------------------------------------

File or assembly name CSDNFunction, or one of its dependencies, was not 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: File or assembly name CSDNFunction, or one of its dependencies, was not 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.

Assembly Load Trace: The following information can be helpful to determine why the assembly 'CSDNFunction' could not be loaded.


=== Pre-bind state information ===
LOG: DisplayName = CSDNFunction, Version=1.0.1235.27323, Culture=neutral, PublicKeyToken=64958407e147fc50
(Fully-specified)
LOG: Appbase = file:///E:/web/Csdn.net
LOG: Initial PrivatePath = bin
Calling assembly : member, Version=1.0.1235.28312, Culture=neutral, PublicKeyToken=null.
===

LOG: Publisher policy file is not found.
LOG: Redirect found in host configuration file (C:\WINNT\Microsoft.NET\Framework\v1.1.4322\aspnet.config): 1.0.1235.27323 redirected to 1.0.1206.32019.
LOG: Using machine configuration file from C:\WINNT\Microsoft.NET\Framework\v1.1.4322\config\machine.config.
LOG: Post-policy reference: CSDNFunction, Version=1.0.1206.32019, Culture=neutral, PublicKeyToken=64958407e147fc50
LOG: Attempting download of new URL file:///C:/WINNT/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/root/993a48f3/c7b3a5cd/CSDNFunction.DLL.
LOG: Attempting download of new URL file:///C:/WINNT/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/root/993a48f3/c7b3a5cd/CSDNFunction/CSDNFunction.DLL.
LOG: Attempting download of new URL file:///E:/web/Csdn.net/bin/CSDNFunction.DLL.
LOG: Attempting download of new URL file:///E:/web/Csdn.net/bin/CSDNFunction/CSDNFunction.DLL.
LOG: Attempting download of new URL file:///C:/WINNT/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/root/993a48f3/c7b3a5cd/CSDNFunction.EXE.
LOG: Attempting download of new URL file:///C:/WINNT/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/root/993a48f3/c7b3a5cd/CSDNFunction/CSDNFunction.EXE.
LOG: Attempting download of new URL file:///E:/web/Csdn.net/bin/CSDNFunction.EXE.
LOG: Attempting download of new URL file:///E:/web/Csdn.net/bin/CSDNFunction/CSDNFunction.EXE.



Stack Trace:


[FileNotFoundException: File or assembly name CSDNFunction, or one of its dependencies, was not found.]
member.Test.Page_Load(Object sender, EventArgs e) +0
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.510; ASP.NET Version:1.1.4322.510
蝈蝈俊 2003-05-20
  • 打赏
  • 举报
回复
不是form 的组件,里面只有算法,没用到其他东西.
elite2018 2003-05-20
  • 打赏
  • 举报
回复
发布服务器 应该正常
asp.net 调用 form 的组件 在1。0 应该不可以

62,074

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧