WCF奇怪的行为

本文关键字:WCF | 更新日期: 2023-09-27 18:05:07

<system.serviceModel>
  <services>
    <service name="Coevery.Services.Document.DocumentService" 
             behaviorConfiguration="aaa">
      <endpoint address="" 
                binding="basicHttpBinding" 
                bindingConfiguration="documentbinding" 
                contract="Coevery.Services.Document.IDocumentService">
      </endpoint>
    </service>
  </services>
  <bindings>
    <basicHttpBinding>
      <binding maxBufferPoolSize="2147483647" 
               maxReceivedMessageSize="2147483647" 
               allowCookies="true">
        <security mode="None">
        </security>
        <readerQuotas maxArrayLength="2147483647" 
                      maxNameTableCharCount="2147483647"
                      maxStringContentLength="2147483647" 
                      maxDepth="2147483647" 
                      maxBytesPerRead="2147483647" />
      </binding>
      <binding name="documentbinding" 
               closeTimeout="04:01:00" 
               openTimeout="04:01:00" 
               receiveTimeout="04:10:00" 
               sendTimeout="04:01:00" 
               allowCookies="false" 
               bypassProxyOnLocal="false" 
               hostNameComparisonMode="StrongWildcard" 
               maxBufferSize="2147483647" 
               maxBufferPoolSize="2147483647" 
               maxReceivedMessageSize="2147483647" 
               messageEncoding="Mtom" 
               textEncoding="utf-8" 
               useDefaultWebProxy="true">
        <readerQuotas maxDepth="2147483647" 
                      maxStringContentLength="2147483647" 
                      maxArrayLength="2147483647" 
                      maxBytesPerRead="2147483647" 
                      maxNameTableCharCount="2147483647" />
      </binding>
    </basicHttpBinding>
  </bindings>
  <behaviors>
    <serviceBehaviors>
      <behavior name="aaa">
        <serviceSecurityAudit auditLogLocation="Application" 
                              serviceAuthorizationAuditLevel="Failure"
                              messageAuthenticationAuditLevel="Failure" 
                              suppressAuditFailure="true" />
        <!-- 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="true" />
        <serviceCredentials>
          <serviceCertificate findValue="WCfServer" 
                              storeLocation="LocalMachine" 
                              storeName="TrustedPeople"
                              x509FindType="FindBySubjectName"/>
        </serviceCredentials>
        <dataContractSerializer maxItemsInObjectGraph="2147483647" />
      </behavior>
    </serviceBehaviors>
  </behaviors>
  <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="True" />
</system.serviceModel>

如果behavior name="aaa" =>此服务的元数据发布当前被禁用。但是没有名字也没关系。

有谁知道这是怎么回事吗?每次使用wcf时我都迷路了:D

WCF奇怪的行为

这是WCF 4的特性。当您提交该名称时,WCF服务将其视为默认行为。参见http://msdn.microsoft.com/en-us/library/ee354381.aspx:

在WCF 3。X,你必须定义命名的行为配置显式地应用于服务和端点"behaviorConfiguration"属性。使用WCF 4,您可以定义默认值通过省略配置中的名称来进行行为配置定义。如果你将这些默认行为添加到machine.config中,它们将应用于托管在机器上的所有服务或端点。

相关文章:
  • 没有找到相关文章