本文介绍了为何拒绝RPC客户端访问。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞!大家好:我做了一个简单的rpc程序。我首先运行RpcServer.exe。然后,我运行RpcClient.exe,它崩溃了。当我调试时,我发现它出现在这一行:    I have made a simple rpc program. I run RpcServer.exe at first. Then, I run RpcClient.exe, It crash. When I debug, I found it occur at this line: NdrClientCall2((PMIDL_STUB_DESC)& MyRpcA_StubDesc,(PFORMAT_STRING)& __ MIDL_ProcFormatString.Format [ 30],(unsigned char *)& nVal);NdrClientCall2(                  ( PMIDL_STUB_DESC  )&MyRpcA_StubDesc,                  (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[30],                  ( unsigned char * )&nVal); Vs2005输出为:First- MyRpcClient.exe中0x7c812a5b的机会异常:0x00000005:访问被拒绝。 MyRpcClient.exe中0x7c812a5b处的未处理异常:0x00000005:访问被拒绝。Vs2005 outputs as : First-chance exception at 0x7c812a5b in MyRpcClient.exe: 0x00000005: Access is denied.Unhandled exception at 0x7c812a5b in MyRpcClient.exe: 0x00000005: Access is denied.我的代码snippit如下:My code snippit is below: status = RpcStringBindingComposeA( NULL //要绑定的UUID。 reinterpret_cast< unsigned char *>(" ncacn_ip_tcp"),//使用TCP / IP协议。 reinterpret_cast< unsigned char *>(" localhost" ),//要使用的TCP / IP网络地址。 reinterpret_cast< unsign ed char *>(" 4747"),//要使用的TCP / IP端口。 NULL,//要使用的协议相关网络选项。& szStringBinding); //字符串绑定输出。status = RpcStringBindingComposeA(  NULL// UUID to bind to.  reinterpret_cast<unsigned char*>("ncacn_ip_tcp"), // Use TCP/IP protocol.  reinterpret_cast<unsigned char*>("localhost"), // TCP/IP network address to use.  reinterpret_cast<unsigned char*>("4747"), // TCP/IP port to use.  NULL, // Protocol dependent network options to use.  &szStringBinding); // String binding output. if(status) exit(status); if (status)  exit(status); //验证字符串绑定句柄的格式并将 //它转换为绑定句柄。 //此处也没有连接。 status = RpcBindingFromStringBindingA( szStringBinding,//用于验证的字符串绑定。结果和放大器; hMyRpcABinding); //将结果放入IDL文件中定义的隐式绑定 //句柄。 // Validates the format of the string binding handle and converts // it to a binding handle. // Connection is not done here either. status = RpcBindingFromStringBindingA(  szStringBinding, // The string binding to validate.  &hMyRpcABinding); // Put the result in the implicit binding        // handle defined in the IDL file. if(status) exit(status); if (status)  exit(status); DoubleNum(5); DoubleNum(5);当进入DoubleNum时(5) ),它会转到NdrClientCall2,然后它会崩溃............When step into DoubleNum(5), It will goto NdrClientCall2, Then, it will crash...........任何建议表示赞赏。谢谢Any suggestion is appreciated. Thanks推荐答案 三年后完全相同的错误,运行windows xp sp3和windows 7three years later exactly the same error, running windows xp sp3 and windows 7得到了你的解决方案?你能分享一下吗?got your solution? can you share it?提前谢谢 这篇关于为何拒绝RPC客户端访问。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-20 05:10
查看更多