首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >wsHttpBinding恢复为基本httpBinding

wsHttpBinding恢复为基本httpBinding
EN

Stack Overflow用户
提问于 2011-01-04 09:20:21
回答 2查看 538关注 0票数 2

我已经使用wsHttpBinding创建了一个服务,但每次我下载该服务时,它都会在客户端的配置中创建基本的wsHttpBinding。你知道为什么吗?thansk

代码语言:javascript
复制
<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>
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2011-01-04 10:09:47

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

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

要解决您的问题:

查看标记右键单击FirstService.svc

  • Click‘
  1. 确保服务属性与web.config中的服务名称属性相匹配。
票数 5
EN

Stack Overflow用户

发布于 2013-01-26 04:43:32

我也有同样的问题,但我的服务是有效的。在我的例子中,我公开了两个绑定,都是basichttp和wshttp。我有一个在.net 3.5上新创建的测试网站。当它获得服务引用时,我注释掉了基本端点。这一切都很好用。

然而,真正的消费者是一个网站,它最初是在.net 2.0中创建的,后来升级到了4.0。因此,我执行与前面相同的过程,注释掉basicHttp端点。但发生的情况是,当我调用服务时得到异常,它期望发送和接收http,服务器在此测试中拒绝连接。

这必须是与升级到4.0的网站,而不是最初在3.5或更高版本创建的东西。我可以断定这是一种升级情况,因为通常存在的属性文件夹并不存在于真正的服务使用者站点上。

必须有一个标志/设置才能打开,但我不确定是什么。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/4589895

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档