首页 新闻 会员 周边

IIS7 调用delphi写的dll报错

0
悬赏园豆:10 [已解决问题] 解决于 2013-09-03 17:05

asp.net程序中,有一调用delphi编写的dll来读取ukey值(注册目的),

程序在xp、window server 2003都可以正常读取运行,但部署到window server 2008就不能正常运行了,会直接造成IIS的应用程序池挂掉!

查看window日志报错误为:错误应用程序 w3wp.exe,版本 7.0.6001.18000,时间戳 0x47919413,错误模块 ntdll.dll,版本 6.0.6001.18000,时间戳 0x4791a7a6,异常代码 0xc0000374,错误偏移量 0x000b015d, 进程 ID 0xcc4,应用程序启动时间 0x01cd5de08c54b3ac。

请问谁有碰到过这类问题,忘指点下。。。

水无声的主页 水无声 | 初学一级 | 园豆:92
提问于:2012-07-09 22:33
< >
分享
最佳答案
0

 

二楼这个回答正解

但是在C#定义方法时使用StringBuilder吧

[DllImport(@"C:\\Test\\DelphiTest.dll", CharSet = CharSet.Ansi)]
public static extern bool StringTest(StringBuilder stringOut, int maxLen);
收获园豆:10
5207 | 初学一级 |园豆:9 | 2012-09-20 14:42
其他回答(3)
0

这个错误日志说明应用程序池Crash了,可能是程序运行时出现了未处理异常。

究竟是什么引起Crash的,需要通过windbg进行分析。

dudu | 园豆:31007 (高人七级) | 2012-07-09 23:33
0

是delphi返回值问题,delphi返回给c#的字符串,应用const pchar返回,C#用StringBuilder接收。

function StringTest(const StringOut : pchar; MaxLen: Integer) : Boolean; stdcall;
begin
StrPLCopy(StringOut, 'Test output string.', MaxLen);
result := true;
end;

[DllImport(@"C:\\Test\\DelphiTest.dll", CharSet = CharSet.Ansi)]
public static extern bool StringTest(ref string stringOut, int maxLen);
水无声 | 园豆:92 (初学一级) | 2012-07-26 08:58
0

我也碰到了这个问题,不知道楼主是怎么解决的

.简单 | 园豆:202 (菜鸟二级) | 2012-11-24 15:48

参考二楼三楼的回复

支持(0) 反对(0) 水无声 | 园豆:92 (初学一级) | 2012-11-25 01:18
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册