一人,一生,一条路!
分类:
2005-04-05 18:06:00
所遇问题1:
问题说明:这个也是应该没什么问题的,这个工程有和别的有点不一样。其中C#调用C#写的dll,但是C#的dll调用的却必须是c++写的dll,而c++写的dll需要调用 c写的dll。如此 ,现在我已把c#写的dll和C++写的dll加到引用中了(c的dll加入不了)。
异常详细信息: System.IO.FileNotFoundException: 找不到文件或程序集名称“TSClientCpp”,或找不到它的一个依赖项。
程序集加载跟踪: 下列信息有助于确定程序集“TSClientCpp”无法加载的原因。
=== Pre-bind state information ===
LOG: DisplayName = TSClientCpp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
(Fully-specified)
LOG: Appbase =
LOG: Initial PrivatePath = bin
Calling assembly : TSClientCS, Version=1.0.1909.19231, Culture=neutral, PublicKeyToken=null.
===
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Post-policy reference: TSClientCpp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
LOG: Attempting download of new URL ASP.NET Files/webtest/781f2e9c/76ef29f6/TSClientCpp.DLL.
LOG: Attempting download of new URL ASP.NET Files/webtest/781f2e9c/76ef29f6/TSClientCpp/TSClientCpp.DLL.
LOG: Attempting download of new URL .
堆栈跟踪:
[FileNotFoundException: 找不到文件或程序集名称“TSClientCpp”,或找不到它的一个依赖项。]
TS.Client.Init(String configFile) +0
webtest.WebForm1.stampFile(String filePath, String file_name) in e:gfa_timestamppackclientwebform1.aspx.cs:122
webtest.WebForm1.Button1_Click(Object sender, EventArgs e) in e:gfa_timestamppackclientwebform1.aspx.cs:86
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1277
解决方案:这个问题改了好长时间,我总觉得没有问题,于是就怀疑是系统报错有问题,但最终还是发现自己的原因。哎:<
就像提示的那样,原因出在 <找不到文件或程序集名称“TSClientCpp”,或找不到它的一个依赖项。> 改正起来不很困难,主要是依赖项的没找到。于是,找到所有TSClientCpp.DLL的依赖文件,全部放到bin下,但,这并不能解决这一矛盾,呵呵,这个我可不知道原因呀。最后,是将其拷贝到 系统的 System32 下才正常的。OK,问题解决。
所遇问题2:
web 开发时 由c#中读入文件路径的配置信息,然后交予c++写的dll来调用读写文件。在有些机器上正常,而在有些机器上会总是报文件不可以访问错误,很讨厌的,即使把所有的 IIS可赋予的权限都赋予了,把文件夹的后有权限都对ASPNET的用户开放了,仍然没能管使,这个问题我也至今没搞明白为什么。最终未能用相对路径,而用了绝对路径,居然好使了。可能是c#读取的路径最终未能正确的传递给c++的dll的原因吧。OK,又解决了一个问题。^-^