这是什么意思,我该如何调试?我在我的结局上设置了什么错误吗?对不起,我仍然试图绕过WCF。
消息:发生操作错误 异常详细信息:System.ServiceModel.FaultException:发生操作错误 来源错误:
第156行:第157行:公开 WcfWebClientWebApplication.ServiceReference1.SubscriptionEntity [] GetSubscriptions(System.Nullable fromDate, System.Nullable toDate){第158行:返回 base.Channel.GetSubscriptions(fromDate,toDate);第159行:} 第160行:
堆栈追踪:
[FaultException:发生操作错误。 ]
System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(即时聊天 reqMsg,IMessage retMsg)+14799942
System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&安培; msgData,Int32类型)+622
WcfWebClientWebApplication.ServiceReference1.IMailSubscription.GetSubscriptions(Nullable1 fromDate, Nullable
1 toDate)+0
WcfWebClientWebApplication.ServiceReference1.MailSubscriptionClient.GetSubscriptions(Nullable1 fromDate, Nullable
1 toDate)in d:_myprojects \ WcfWebClientWebApplication \ WcfWebClientWebApplication \服务 参考\ ServiceReference1 \ Reference.cs:158个
WcfWebClientWebApplication.Default.Page_Load(Object sender,EventArgs e)in d:_myprojects \ WcfWebClientWebApplication \ WcfWebClientWebApplication \ Default.aspx.cs:17 System.Web.UI.Control.LoadRecursive()+71
System.Web.UI.Page.ProcessRequestMain(布尔 includeStagesBeforeAsyncPoint,Boolean includeStagesAfterAsyncPoint) 3178
代码文件:
protected void Page_Load(object sender, EventArgs e)
{
var client = new MailSubscriptionClient();
client.ClientCredentials.UserName.UserName = "myUsername";
client.ClientCredentials.UserName.Password = "myPassword";
var result = client.GetSubscriptions(DateTime.Today.AddDays(-1), DateTime.Today);
client.Close();
}
的web.config
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="wsHttp_Username">
<security mode="TransportWithMessageCredential">
<transport clientCredentialType="None" />
<message clientCredentialType="UserName" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="https://mydomain.com/MailSubscription.svc"
binding="wsHttpBinding" bindingConfiguration="wsHttp_Username"
contract="ServiceReference1.IMailSubscription" />
</client>
</system.serviceModel>