WebService调用Dll

zxh806 2014-08-22 02:30:21
我有一个用Dephi写的DLL,在C#写的WebService里引用,调用其中的一个函数返回一个字符串内容,在调试环境下都可以传回正确结果,可是发布到IIS后,就没有结果返回,WebService里不能调用别的DLl吗,我试了,直接用C#生成的Dll是可以用的。
...全文
2883 16 打赏 收藏 转发到动态 举报
写回复
用AI写文章
16 条回复
切换为时间正序
请发表友善的回复…
发表回复
theodore26 2016-06-16
  • 打赏
  • 举报
回复
之前做过一个WebService调用dll,dll需要读取当前路径里的配置文件。 发现配置文件需要放到C:\Windows\System32\inetsrv文件夹里才能被读到,进一步测试后发现Win7/Server2003系统是这个路径,XP系统的路径是C:\Windows\System32。高于XP估计都是要放到C:\Windows\System32\inetsrv文件夹里。 另外,如果配置文件的内容有修改,需要重启IIS才能更新读取到的配置内容。
zc594634676 2016-01-26
  • 打赏
  • 举报
回复
遇到同样的问题,楼主解决了没 ,能分享一下吗
highfiresun 2015-08-29
  • 打赏
  • 举报
回复
我也遇到同样的问题,请问楼主问题解决了吗?能否分享一下?
zxh806 2015-01-16
  • 打赏
  • 举报
回复
权限也试过都设成了everyone,程序池也是把支持32位的设上去了,怎么就是不行呢?
华芸智森 2014-12-14
  • 打赏
  • 举报
回复
估计是路径问题. 你将DLL COPY到相同目录下.并且给 EVERY ONE 权限试试看.
zxh806 2014-12-04
  • 打赏
  • 举报
回复
代码跟这个都是类似的,我测试了在XP下面IIS版本比较低的如IIS6都是可以用的,但是高版本就不行IIS7以上就不行好像,因该是跟权限设置有关系,可是该设置的都设置了,为什么会不行呢?
dlx_2632641148 2014-09-27
  • 打赏
  • 举报
回复
封装并生成调用DLL类库 using System; using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices; namespace MobileSP { public class GMS { //初始化gsm modem,并连接gsm modem [DllImport("dllforvc.dll", EntryPoint = "GSMModemInitNew", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] public static extern bool GSMModemInitNew( string device, string baudrate, string initstring, string charset, bool swHandshake, string sn); //获取短信猫新的标识号码 [DllImport("dllforvc.dll", EntryPoint = "GSMModemGetSnInfoNew", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] public static extern string GSMModemGetSnInfoNew(string device, string baudrate); //获取当前通讯端口 [DllImport("dllforvc.dll", EntryPoint = "GSMModemGetDevice", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] public static extern string GSMModemGetDevice(); //获取当前通讯波特率 [DllImport("dllforvc.dll", EntryPoint = "GSMModemGetBaudrate", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] public static extern string GSMModemGetBaudrate(); //断开连接并释放内存空间 [DllImport("dllforvc.dll", EntryPoint = "GSMModemRelease", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] public static extern void GSMModemRelease(); //取得错误信息 [DllImport("dllforvc.dll", EntryPoint = "GSMModemGetErrorMsg", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] public static extern string GSMModemGetErrorMsg(); //发送短信息 [DllImport("dllforvc.dll", EntryPoint = "GSMModemSMSsend", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] public static extern bool GSMModemSMSsend( string serviceCenterAddress, int encodeval, string text, int textlen, string phonenumber, bool requestStatusReport);//CodeGo.net/ //接收短信息返回字符串格式为:手机号码|短信内容||手机号码|短信内容|| //RD_opt为1接收短信息后不做任何处理,0为接收后删除信息 [DllImport("dllforvc.dll", EntryPoint = "GSMModemSMSReadAll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] public static extern string GSMModemSMSReadAll(int RD_opt); } } //将类库引用保存在Bin目录下即可调用
zxh806 2014-09-06
  • 打赏
  • 举报
回复
都试过了,不行,我的是Win2008系统,在XP系统下是可以的
-小蕾- 2014-09-03
  • 打赏
  • 举报
回复
另外webservice的 <system.web> 节点下是否有? <webServices> <protocols> <add name= "HttpPost " /> <add name= "HttpGet " /> </protocols> </webServices>
-小蕾- 2014-09-03
  • 打赏
  • 举报
回复
应用程序池,高级设置,启动32位应用程序设置为True 试试看。
zxh806 2014-08-22
  • 打赏
  • 举报
回复
http://192.168.155.10:8088/XDService.asmx XDService 支持下列操作。有关正式定义,请查看服务说明。 •GetConStr2 得到连接字符串 •XdEncrypt2 加密字符串 这个服务中简单做了两个函数,XdEncrypt2就是调用Dll中的一个函数,输入参数后,就出问题了,但是在调试状态下都是可以正确返回内容的。
zxh806 2014-08-22
  • 打赏
  • 举报
回复
就是打开网页没反应, 无法显示此页,在回车刷新就会提示很多: “/”应用程序中的服务器错误。 -------------------------------------------------------------------------------- 因 URL 意外地以“/XdEncrypt2”结束,请求格式无法识别。 说明: 执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.InvalidOperationException: 因 URL 意外地以“/XdEncrypt2”结束,请求格式无法识别。 源错误: 执行当前 Web 请求期间生成了未经处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。 堆栈跟踪: [InvalidOperationException: 因 URL 意外地以“/XdEncrypt2”结束,请求格式无法识别。] System.Web.Services.Protocols.WebServiceHandlerFactory.CoreGetHandler(Type type, HttpContext context, HttpRequest request, HttpResponse response) +489333 System.Web.Services.Protocols.WebServiceHandlerFactory.GetHandler(HttpContext context, String verb, String url, String filePath) +212 System.Web.Script.Services.ScriptHandlerFactory.GetHandler(HttpContext context, String requestType, String url, String pathTranslated) +48 System.Web.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +346 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155 -------------------------------------------------------------------------------- 版本信息: Microsoft .NET Framework 版本:4.0.30319; ASP.NET 版本:4.0.30319.18449
宝_爸 2014-08-22
  • 打赏
  • 举报
回复
什么错误????
zxh806 2014-08-22
  • 打赏
  • 举报
回复
我把dll文件拷到system32下面试了也不行,我也感觉是权限问题,可是我把文件以及文件夹的权限把管理员以及 everyone以及NetWork Service都添加上去了还是不行。
宝_爸 2014-08-22
  • 打赏
  • 举报
回复
一个问题是dependency. delphi写的dll所需要的动态库也需要安装到服务器上。 另一个问题是路径问题,asp.net的当前路径好像在c:\windows\Microsoft.net\framework下的什么地方,因此你可以吧dll放到system32中,或者把所在路径加入到环境变量中试一试。 我们是在代码中把路径加入到环境变量中 string cadServerPath = 路径; string orgPath = Environment.GetEnvironmentVariable("PATH"); string path = String.Concat(cadServerPath, ";", orgPath); Environment.SetEnvironmentVariable("PATH", path);
rtdb 2014-08-22
  • 打赏
  • 举报
回复
不应该有问题的,多半是IIS权限不足

12,162

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 Web Services
社区管理员
  • Web Services社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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