获取“System.AccessViolationException”使用 RightFax 的 C# 中的异常
我正在尝试通过 RightFax COM API 库发送传真:
RFCOMAPILib.FaxServer server = new RFCOMAPILib.FaxServer();
server.ServerName = "xxx";
server.Protocol = CommunicationProtocolType.cpTCPIP;
server.UseNTAuthentication = BoolType.True;
// Error happens here
server.OpenServer();
RFCOMAPILib.Fax fax = (RFCOMAPILib.Fax)server.get_CreateObject(RFCOMAPILib.CreateObjectType.coFax);
fax.ToName = "Batman";
fax.ToFaxNumber = "23434484";
fax.FromFaxNumber = "78678676";
fax.FromName = "Robin";
fax.Send();
我已经注册了 DLL 文件 rfcomapi.dll
:
C:\Program Files\RightFAX> RegSvr32 rfcomapi.dll
不幸的是,在运行此代码时,出现以下错误;
未处理的异常:system.AccessViolationException:尝试读取或写入受保护的内存。这通常表明其他内存已损坏。
我使用的是 RightFax 9.4.0.0 版本。
我该如何解决这个问题?
I'm trying to send faxes through RightFax COM API Library:
RFCOMAPILib.FaxServer server = new RFCOMAPILib.FaxServer();
server.ServerName = "xxx";
server.Protocol = CommunicationProtocolType.cpTCPIP;
server.UseNTAuthentication = BoolType.True;
// Error happens here
server.OpenServer();
RFCOMAPILib.Fax fax = (RFCOMAPILib.Fax)server.get_CreateObject(RFCOMAPILib.CreateObjectType.coFax);
fax.ToName = "Batman";
fax.ToFaxNumber = "23434484";
fax.FromFaxNumber = "78678676";
fax.FromName = "Robin";
fax.Send();
I have registered the DLL file rfcomapi.dll
:
C:\Program Files\RightFAX> RegSvr32 rfcomapi.dll
Unfortunately, when running this code, I get the following error;
Unhandled Exception: system.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
I'm using version 9.4.0.0 of RightFax.
How do I fix this problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你的代码本身是完美的。我可以用我的 9.4 RightFax 运行它,没有任何问题。您可能需要检查您的授权,以确保您的帐户在服务器中获得完全授权。
Your code itself is perfect. I can run it with my 9.4 RightFax without any problem. You may want to check with your authorization to make sure you account is full authorized in the server.
问题是服务器名称不正确,因为我们无法在网络中解析该名称。我对服务器进行了 ping 操作,但什么也没得到,但是我得到了它的 IP 地址,并且工作正常!
始终使用 RightFax ping 服务器!您将收到的错误消息描述性不强!
The problem was the server name was incorrect, since we couldn't resolve that name in our network. I pinged the server and I got nothing, however I got the IP address of it and it worked fine!
Always ping the server with RightFax! The error messages you are going to get are not very descriptive!