开发者

Process.Start inside a WCF method

When I run this code via WCF Test Client with the localhost address, it is working.

string batch = "C:/Users/Administrator/Desktop/Batch/tvPower.lnk";
Process.Start(batch);
return "done";

*I used lnk ( Shortcut link) instead of bat because i need to run the command in admin mode but i wasnt able to do so. The nearest workaround was to use lnk.

But when I tried to run this code via WCF Test Client with the hosted ip, it is not working and return the following error.

"Failed to invoke the service. Possible causes: The service is offline or inaccessible; the client-side configuration does not match the proxy; the existing proxy is invalid. Refer to the stack trace for more detail. You can try to recover by starting a new proxy, restoring to default configuration, or refreshing the service."

The f开发者_开发问答ollowing is the stack,

Server stack trace: at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter) at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at Ix10Service.A1On() at Ix10ServiceClient.A1On()

Can anyone point me to the right direction on how can I get this working?

Thanks!


It's probably the configuration of your client -- it has nothing to do with what the service is doing.

Check your client's config file and verify that it specifies the same address, bindings and contract as the service.


Verify that the Identity the service is running under has the correct permissions to execute Process.Start and access C:/Users/Administrator/Desktop/Batch/. If possible log in as that user on the machine and give it a try, or just see what permissions are needed and grant that user access. If you are hosting it in IIS go to that web app, see the application pool it is running under and then go to advanced settings -> Identity.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜