wsHttpBinding还原为基本的httpBinding

use*_*080 2 wcf

我用wsHttpBinding创建了一个服务,但每次下载服务时,它都会在客户端的配置中创建basichttpbinding.有什么想法吗?thansk

<system.serviceModel>
    <serviceHostingEnvironment/>
    <bindings>

      <wsHttpBinding>
        <binding name="WSHttpBinding" sendTimeout="00:10:00" receiveTimeout="00:59:00" bypassProxyOnLocal="false"
         transactionFlow="false" hostNameComparisonMode="StrongWildcard"
         maxBufferPoolSize="50000000" maxReceivedMessageSize="50000000"
         messageEncoding="Mtom" textEncoding="utf-8" useDefaultWebProxy="true"
         allowCookies="false">
          <readerQuotas maxDepth="32" maxStringContentLength="50000000"
           maxArrayLength="50000000" maxBytesPerRead="4096" maxNameTableCharCount="2147483647" />
          <reliableSession inactivityTimeout="00:59:00" />
          <security mode="Message">
            <!--<transport clientCredentialType="Windows" proxyCredentialType="None"
       realm="" />-->
            <message clientCredentialType="UserName" negotiateServiceCredential="true"
             algorithmSuite="Default" establishSecurityContext="true" />
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>

    <services>
      <service behaviorConfiguration="AdviserPayServiceBehaviour" name="AdviserPay.Services.FirstService.FirstService">
        <endpoint binding="wsHttpBinding" bindingConfiguration="WSHttpBinding" contract="AdviserPay.Services.FirstService.IFirstService" />
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>
    </services>

    <behaviors>
      <serviceBehaviors>
        <behavior name="AdviserPayServiceBehaviour">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
          <serviceAuthorization principalPermissionMode="None" impersonateCallerForAllOperations="false" />
          <serviceCredentials>
            <userNameAuthentication userNamePasswordValidationMode="Custom"
              membershipProviderName="AdviserPayCustomMembershipProvider" />
          </serviceCredentials>
          <serviceSecurityAudit auditLogLocation="Application" suppressAuditFailure="false"
            serviceAuthorizationAuditLevel="None" messageAuthenticationAuditLevel="SuccessOrFailure" />
          <serviceThrottling maxConcurrentCalls="100" maxConcurrentSessions="100" />
        </behavior>
        <behavior name="">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
Run Code Online (Sandbox Code Playgroud)

Gre*_*som 5

.svc标记文件中的服务名称可能与web.config中指定的名称不匹配.

当WCF启动您的服务时,框架会检查.svc文件中的服务名称,然后在web.config中查找与该名称匹配的配置.如果未找到,则使用默认配置 - BasicHttpBinding.

要解决您的问题:

  1. 右键单击FirstService.svc
  2. 点击"查看标记"
  3. 确保Service属性与web.config中的服务名称属性匹配.