设为首页 收藏本站
查看: 1096|回复: 0

[经验分享] Delphi编写的webservice和windows 2003的兼容问题

[复制链接]
累计签到:2 天
连续签到:1 天
发表于 2015-11-2 13:37:58 | 显示全部楼层 |阅读模式
Delphi编写的webservice和windows 2003的兼容问题近日在delphi中写了个webservice的服务端程序,本机调试通过的,但是部署到windows 2003的时候出了问题。  首先是windows 2003安装时没带IIS,结果下了个IIS6.0,不想配置和xp下的配置不一样了,如果没有配web扩展服务根本就访问不到那个webservice。
  琢磨了半天,才能够访问exe了,结果又出了个500错,说是访问ntdll.dll时有个空指针错误。比较了下,发现确实xp和2003的这个dll文件不同,但是copy不了,因为windows2003在检测到这个文件变了之后马上就覆盖回来了。
  到网上找了半天,终于在一篇博客中找到原因,原来是delphi的内核中有个bug,需要修改。附上该博客原文。
  
  Delphi ISAPI and Windows 2003 compatiblity
I had a perfetly OK ISAPI on my Windows 2000 Server. Spending months to
  write and debug it has made it a smoothly working peace of work. Then
  suddenly we decided to test it on a Windows 2003 Server. As you'd
  expect, when Microsoft changes a piece of its operating system, it
  shouldn't surprise you if you end up recompiling your Delphi projects.
  For the start, I tryied just to copy the ISAPI to the new machine and
  see if it works. It didn't. It couldn't find the damn thing and was
  giving me 404 Page Not Found error and many other stupid errors. So here
  is how I solved it:
  First of all, you need to "introduce" your code (ISAPI or CGI) to the
  new IIS 6. In order to do this, go to IIS MMC and "allow" your DLL (or
  CGI exe) in Web Service Management branch of the left panel tree.
  Now try to run your ISAPI. It might work depending on the instructions
  you have used in your code. If it gives you something like
Server Error 500
Exception: EAccessViolation
Message: Access violation at address 77F4831D in module 'ntdll.dll'.
Write of address 0040476D
  Then you need to fix a bug in Delphi kernel. Open SysUtils.pas
  (delphi/Source/Rtl/Sys) and replace the GetEnvironmentVariable function
  with the following:
  function GetEnvironmentVariable(const Name: string): string;
var
Len: integer;
W : String;
begin
Result := '';
SetLength(W,1);
Len := GetEnvironmentVariable(PChar(Name), PChar(W), 1);
if Len > 0 then
begin
SetLength(Result, Len - 1);
GetEnvironmentVariable(PChar(Name), PChar(Result), Len);
end;
end;
  Recompile your ISAPI and it should work now. Remember to make sure this
  new SysUtil.pas file gets compiled. You might need to delete its DCU
  file from Bin or other folders or add its folder to Delphi search path
  in order to force delphi to compile it again.
  I have found this solution somewhere in a newsgroup, but I can't find it
  again to give "JP" his/her credit

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-134130-1-1.html 上篇帖子: 设windows 2003远程访问服务器 下篇帖子: mysql 6.1.2部署windows 2003出错
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表