2010-10-15 62 views
1

我正在嘗試創建一個過程來驗證數據庫中的數據並通知用戶有錯誤。我最初的想法是創建一個Web服務,當用戶保存Web表單時觸發。該Web服務將開始驗證數據並向另一個表填充其認爲無效的信息的過程。從一開始我就打算讓這個Web服務在實際完成數據驗證之前立即返回。數據驗證將是一個更長的過程,並不打算成爲表單驗證。如果它發生故障也是可以的,因爲該過程每晚都會刷新,所以我不擔心這一點。isOneWay WCF服務

單向服務似乎是最合理的選擇。我已經寫了這個服務,沒有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> 
+0

你可以發佈服務器端的wcf配置嗎? – softveda 2010-10-15 21:28:22

+0

這是非常基本的:我認爲這是你需要的一切,讓我知道如果你看到任何不一致,我不得不刪除一些名字。 – 2010-10-15 22:54:51

+0

通知您標記了您的問題「wfc」而不是「wcf」( - :。僅供下次使用.. – 2010-10-15 23:20:13

回答

0

我發現了這個問題。這可能看起來很奇怪,但是服務在同一個項目中運行,並且似乎導致將它用作單向服務的問題。我將它移出到自己的項目中,一切都按預期工作。

我感謝大家他們的時間,跟蹤將在未來證明是有用的。

1

當運行到像這些在WCF,其中一些停在更改配置時的工作問題,我肯定會通過跟蹤正在運行的服務啓動。 WCF有一個很好的跟蹤機制,您可以通過編輯配置開始。你可以閱讀所有關於配置它here

+0

感謝您提供此信息,它將在未來證明是有用的。 – 2010-10-20 16:34:28