我正在尝试创建一个在数据库中验证数据并通知用户错误的进程。我最初的想法是创建一个在用户保存web表单时触发的web服务。该web服务将开始验证数据的过程,并用它认为无效的信息填充另一个表。从一开始,我就打算让这个web服务在实际完成数据验证之前立即返回。数据验证将是一个更长的过程,并不打算是表单验证。如果它碰巧失败也没关系,因为这个过程每天晚上都会刷新,所以我不担心这一点。
对于这一点,OneWay服务似乎是最合理的选择。我已经写好了服务,在没有OneWay的情况下一切都运行得很好。然而,一旦我添加了OneWay,这个过程就不再起作用了。让我特别困惑的是,我在web服务方法的最开始有一行输出日志文件,当我调用该服务时,它偶尔会写入日志。不是每一次,但有时。我也有多个输出的日志语句,一旦启用了isOneWay,它就再也没有超过第一行。看起来代码就像是被任意停止了。以前有没有人遇到过这种情况?我的下一个选择是创建一个网络队列任务,它直接接收web服务调用并将其添加到它的队列中,我希望避免这样做。
更多的背景信息,我是WCF服务的新手,但不是一般的web服务。web应用程序是用ASP.Net编写的,并通过HttpGet调用web服务。
我对其他架构建议持开放态度,任何意见都非常感谢。
下面是来自web.config的ServiceModel元素:
<system.serviceModel>
<bindings>
<customBinding>
<binding name="WebHttpBinding_Service">
<textMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16"
messageVersion="Soap12" writeEncoding="utf-8">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</textMessageEncoding>
<httpTransport authenticationScheme="Negotiate,Ntlm"/>
</binding>
</customBinding>
<webHttpBinding>
<binding name="webHttpBinding_IISAuthen">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" />
</security>
</binding>
</webHttpBinding>
</bindings>
<services>
<service name="Namespace.Service" behaviorConfiguration="Namepsace.ServiceBehavior">
<endpoint address="" behaviorConfiguration="Namespace.ServiceAspNetAjaxBehavior"
binding="webHttpBinding" bindingConfiguration="webHttpBinding_IISAuthen" contract="Namespace.Service" />
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="Namespace.ServiceAspNetAjaxBehavior">
<enableWebScript />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="Namespace.ServiceBehavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true" />
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<client>
<endpoint binding="customBinding" bindingConfiguration="WebHttpBinding_Service"
contract="Service" name="WebHttpBinding_Service" />
</client>
</system.serviceModel>发布于 2010-10-21 00:33:58
我发现了问题。这可能看起来很奇怪,但该服务是在同一个项目中运行的,这似乎导致了将其用作单向服务的问题。我把它移到了它自己的项目中,一切都像预期的一样。
我感谢大家花时间,跟踪肯定会在未来被证明是有用的。
发布于 2010-10-16 08:06:07
当在WCF中遇到这样的问题时,当更改配置时某些东西停止工作时,我肯定会从跟踪正在运行的服务开始。WCF有一个很好的跟踪机制,您可以从编辑配置开始。您可以阅读所有关于配置它的here。
https://stackoverflow.com/questions/3946150
复制相似问题