[英]Console application consuming wcf service
我有一个运行良好的ac#asp.net Web应用程序/项目。 后来,我将此项目添加了wcf服务作为新项目。 然后,我向此解决方案添加一个新的简单控制台应用程序以使用wcf。 在我当地的地方效果很好。 (我的本地服务器名称为A。同时使用[http://A/MyProjName/wcfSendRpt.svc]或[http://localhost/MyProjName/wcfSendRpt.svc]都可以)。 然后,我将我的Web应用程序(带有wcf服务)发布到了实时服务器B。 svc]正常工作。 然后,我将控制台应用程序部署到服务器B。(我只是将exe和配置文件复制到服务器B)。 我将配置文件中的端点地址从[http://A/MyProjName/wcfSendRpt.svc]更改为[http://B/wcfSendRpt.svc],如下所示
<endpoint address="http://B/wcfSendRpt.svc" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IwcfSendRpt"
contract="nsSendRpt.IwcfSendRpt" name="BasicHttpBinding_IwcfSendRpt" />
但这是行不通的。 事件日志中的错误如下所示:
Unhandled Exception: System.ServiceModel.FaultException`1[System.ServiceModel.Ex
ceptionDetail]: An error occurred while executing the command definition. See th
e inner exception for details.
Server stack trace:
at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message
reply, MessageFault fault, String action, MessageVersion version, FaultConverte
r faultConverter)
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRunt
ime operation, ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean on
eway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan tim
eout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCall
Message methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage req
Msg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgDa
ta, Int32 type)
at CAScheduledService.nsSendRpt.IwcfSendRpt.SendRpt(String statementdate)
at CAScheduledService.Program.Main(String[] args)
我的控制台应用程序非常简单:代码如下
class Program
{
static void Main(string[] args)
{
nsSendRpt.IwcfSendRptClient ss = new IwcfSendRptClient();
string a = ss.SendRpt(System.DateTime.Now.ToString("yyyyMMdd"));
ss.Close();
}
}
我需要您的帮助来解决此问题。 我在wcf中还很陌生。 我的Web应用程序中的WCF服务是否稳定?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.