标签: basichttpbinding

BasicHttpBinding vs WsHttpBinding vs WebHttpBinding

在WCF中,有几种不同类型的基于HTTP的绑定:

这3个有什么不同?

特别是在功能/性能和兼容性方面有何不同?

basichttpbinding wcf-binding wshttpbinding webhttpbinding

291
推荐指数
1
解决办法
16万
查看次数

已超出传入邮件的最大邮件大小限额(65536)

我为几个表创建范围时得到了这个异常,所有这些表都是巨大的设计

<bindings>
    <wsHttpBinding>
        <binding name="wsHttpBinding_ISyncServices" closeTimeout="00:10:00"
            openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
            transactionFlow="false" hostNameComparisonMode="StrongWildcard"
            maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
            <readerQuotas maxDepth="32" maxStringContentLength="2147483647"
                maxArrayLength="2147483647" maxBytesPerRead="2147483647"
                maxNameTableCharCount="2147483647" />
            <reliableSession ordered="true" inactivityTimeout="00:10:00"
                enabled="false" />
            <security mode="Message">
                <transport clientCredentialType="Windows"
                    proxyCredentialType="None" realm="">
                    <extendedProtectionPolicy policyEnforcement="Never" />
                </transport>
                <message clientCredentialType="Windows"
                    negotiateServiceCredential="true" algorithmSuite="Default" />
            </security>
        </binding>
    </wsHttpBinding>
</bindings>
Run Code Online (Sandbox Code Playgroud)

我已经做到MaxReceivedMessageSize2147483647,但它仍然在这条线下给我以下例外

 client.GetTableDescription(scopeName, syncTable)
Run Code Online (Sandbox Code Playgroud)

已超出传入邮件的最大邮件大小限额(65536).
要增加配额,请在相应的绑定元素上使用MaxReceivedMessageSize属性.

wcf basichttpbinding

66
推荐指数
6
解决办法
9万
查看次数

如何在WCF中修复"找不到与schema http匹配的基地址"....

我正在尝试将WCF服务部署到我的服务器,托管在IIS中.当然它适用于我的机器:)

但是当我部署它时,我收到以下错误:

此集合已包含方案http的地址.此集合中每个方案最多只能有一个地址.

谷歌搜索,我发现我必须将一个serviceHostingEnvironment元素放入web.config文件:

<serviceHostingEnvironment>
  <baseAddressPrefixFilters>
    <add prefix="http://mywebsiteurl"/>
  </baseAddressPrefixFilters>
</serviceHostingEnvironment>
Run Code Online (Sandbox Code Playgroud)

但是一旦我这样做了,我得到以下内容:

无法通过绑定BasicHttpBinding找到与端点的scheme http匹配的基址.注册的基地址方案是[https].

它似乎不知道基地址是什么,但我该如何指定呢?这是我的web.config文件的相关部分:

<system.serviceModel>
  <serviceHostingEnvironment>
    <baseAddressPrefixFilters>
      <add prefix="http://mywebsiteurl"/>
    </baseAddressPrefixFilters>
  </serviceHostingEnvironment>

  <behaviors>
    <serviceBehaviors>
      <behavior name="WcfPortalBehavior">
        <serviceMetadata httpGetEnabled="true"/>
        <serviceDebug includeExceptionDetailInFaults="true"/>
      </behavior>
    </serviceBehaviors>
  </behaviors>
  <bindings>
    <basicHttpBinding>
      <binding name="BasicHttpBinding_IWcfPortal"
               maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"
               receiveTimeout="00:10:00" sendTimeout="00:10:00"
               openTimeout="00:10:00" closeTimeout="00:10:00">
        <readerQuotas maxBytesPerRead="2147483647" maxArrayLength="2147483647"
               maxStringContentLength="2147483647"/>
      </binding>
    </basicHttpBinding>
  </bindings>

  <services>
    <service behaviorConfiguration="WcfPortalBehavior" name="Csla.Server.Hosts.Silverlight.WcfPortal">
      <endpoint address="" binding="basicHttpBinding" contract="Csla.Server.Hosts.Silverlight.IWcfPortal"
      bindingConfiguration="BasicHttpBinding_IWcfPortal">
      </endpoint>
      <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
    </service>
  </services>
</system.serviceModel>
Run Code Online (Sandbox Code Playgroud)

任何人都可以了解正在发生的事情以及如何解决这个问题?

iis wcf basichttpbinding

34
推荐指数
3
解决办法
10万
查看次数

大二进制(byte [])通过WCF传输文件

我正在尝试构建一个WCF服务,允许我从客户端向服务发送大型二进制文件.

但是我只能成功传输高达3-4MB的文件.(当我尝试转移4.91MB时,我失败了,当然,除了之外)

如果我尝试发送4.91MB文件,我得到的错误是:

异常消息:接收到http:// localhost:56198/Service.svc的HTTP响应时发生错误.这可能是由于服务端点绑定不使用HTTP协议.这也可能是由于服务器中止HTTP请求上下文(可能是由于服务关闭).请参阅服务器日志以获取更多详

内部异常消息:基础连接已关闭:接收上发生意外错误.

内部异常消息:无法从传输连接读取数据:远程主机强制关闭现有连接.

内部异常消息:远程主机强制关闭现有连接

一旦将byte []文件作为方法参数发送到公开的服务方法,就会在客户端发生此错误.

我在服务方法的第一行有一个断点,如果文件传输成功(低于3MB),则会触发断点并传输文件.但是在这种情况下,只要调用该方法,就会出现错误.如果出现此错误,则不会触发服务中的断点.

我将粘贴我的Service Web.config和Asp Page(Client)Web.config的各个部分.如果您还需要发送文件并接受文件的代码,请告诉我,我也会发送该文件.

服务Web.Config

<system.serviceModel>
<bindings>
  <basicHttpBinding>
    <binding name="basicHttpEndpointBinding" closeTimeout="01:01:00"
      openTimeout="01:01:00" receiveTimeout="01:10:00" sendTimeout="01:01:00"
      allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
      maxBufferSize="2147483646" maxBufferPoolSize="2147483646" maxReceivedMessageSize="2147483646"
      messageEncoding="Mtom" textEncoding="utf-8" transferMode="StreamedRequest"
      useDefaultWebProxy="true">
      <readerQuotas maxDepth="2147483646" maxStringContentLength="2147483646" maxArrayLength="2147483646"
        maxBytesPerRead="2147483646" maxNameTableCharCount="2147483646" />
      <security mode="None">
        <transport clientCredentialType="None" proxyCredentialType="None"
          realm="" />
        <message clientCredentialType="UserName" algorithmSuite="Default" />
      </security>
    </binding>        
  </basicHttpBinding>      
</bindings>
    <services>
        <service behaviorConfiguration="DragDrop.Service.ServiceBehavior" name="DragDrop.Service.Service">
            <endpoint address="" binding="basicHttpBinding" bindingConfiguration="basicHttpEndpointBinding" contract="DragDrop.Service.IService">
                <identity>
                    <dns value="localhost"/>
                </identity>
            </endpoint>
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> …
Run Code Online (Sandbox Code Playgroud)

.net c# asp.net wcf basichttpbinding

21
推荐指数
3
解决办法
6万
查看次数

主机上配置的身份验证方案('Anonymous')不允许在绑定'BasicHttpBinding'('Negotiate')上配置的身份验证方案.

主机上配置的身份验证方案('Anonymous')不允许在绑定'BasicHttpBinding'('Negotiate')上配置的身份验证方案.请确保将SecurityMode设置为Transport或TransportCredentialOnly.此外,可以通过IIS管理工具,通过ServiceHost.Authentication.AuthenticationSchemes属性,在元素的应用程序配置文件中更改此应用程序的身份验证方案,通过更新绑定上的ClientCredentialType属性,或通过调整HttpTransportBindingElement上的AuthenticationScheme属性.

wcf basichttpbinding wcf-security transport-security

21
推荐指数
3
解决办法
5万
查看次数

.NET或Win32等效的"netsh http add urlacl"命令

关于如何允许自托管WCF应用程序使用Basic.SttpBinding与HTTP.SYS而不需要管理权限,有几个 问题.它归结为需要向URL授予权限(从管理上下文),然后用户可以在指定的URL上托管任何内容.

netsh http add urlacl url = http:// +:80/MyService

我希望能够查询和添加注册的URL,而无需解析"netsh"或"httpconfig"命令行工具的命令行输出.

是否有可以调用此功能的公共Win32或.NET API?

wcf basichttpbinding httpcfg.exe netsh

20
推荐指数
1
解决办法
6804
查看次数

Wcf基本身份验证

使用简单的测试Wcf服务使用基本身份验证时遇到一些麻烦.我得到一个例外:

无法激活所请求的服务"http://qld-tgower/test/Service.svc".有关详细信息,请参阅>服务器的诊断跟踪日志.

在跟踪日志中显示:

主机上配置的身份验证方案("基本")不允许在绑定"BasicHttpBinding"("匿名")上配置的身份验证方案.请确保将SecurityMode设置为Transport或TransportCredentialOnly.此外,可以通过IIS管理工具,在<serviceAuthenticationManager>元素的应用程序配置文件中,通过更新绑定上的ClientCredentialType属性,通过ServiceHost.Authentication.AuthenticationSchemes属性更改此应用程序的身份验证方案来解决此问题.或者通过调整HttpTransportBindingElement上的AuthenticationScheme属性.

但是,我不知道,当我我们不正确的用户名和密码,它说,它IS使用基本身份验证?

HTTP请求未经授权使用客户端身份验证方案"Basic".从服务器收到的验证头是'Basic realm ="qld-tgower"'.

这是我的web.config详细信息

<system.serviceModel>
<services>
  <service name="WcfService"
      behaviorConfiguration="Behavior">
    <endpoint address="http://QLD-TGOWER/test/Service.svc"
              binding="basicHttpBinding"
              bindingConfiguration="httpBinding"
              contract="IService" />
  </service>
</services>
<diagnostics>
  <endToEndTracing activityTracing="false" messageFlowTracing="true" propagateActivity="true"></endToEndTracing>
</diagnostics>
<bindings>
  <basicHttpBinding>
    <binding name="httpBinding">
      <security mode="TransportCredentialOnly">
        <transport  clientCredentialType="Basic" proxyCredentialType="Basic">
        </transport>
      </security>
    </binding>
  </basicHttpBinding>
</bindings>
<behaviors>
  <serviceBehaviors>
    <behavior>
      <!-- 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, …
Run Code Online (Sandbox Code Playgroud)

wcf basichttpbinding

20
推荐指数
1
解决办法
6万
查看次数

如何以编程方式创建此自定义绑定?

我们必须访问使用soap11的Web服务...没问题我只需将绑定设置为:

BasicHttpBinding wsBinding = new BasicHttpBinding(BasicHttpSecurityMode.TransportWithMessageCredential);
Run Code Online (Sandbox Code Playgroud)

不.没有骰子.所以我问服务主机为什么我们遇到身份验证问题,他说我们的配置需要这个自定义绑定:

<bindings>
    <customBinding>
        <binding name="lbinding">
            <security  authenticationMode="UserNameOverTransport" 
                messageSecurityVersion="WSSecurity11WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11" 
                securityHeaderLayout="Strict" 
                includeTimestamp="false"
                requireDerivedKeys="true" 
                keyEntropyMode="ServerEntropy">
            </security>
            <textMessageEncoding messageVersion="Soap11" />
            <httpsTransport authenticationScheme ="Negotiate" requireClientCertificate ="false" realm =""/>
        </binding>
    </customBinding>
</bindings>
Run Code Online (Sandbox Code Playgroud)

唯一的问题是我们是以编程方式创建绑定而不是通过配置.因此,如果有人可以指出我正确的方向,将我的BasicHttpBinding更改为符合.config值的自定义绑定,我会给他们一个闪亮的金色星星.

wcf basichttpbinding wcf-binding

19
推荐指数
2
解决办法
2万
查看次数

如何在IIS中仅使用WCF进行basichttpbinding,SSL和基本身份验证?

是否可以仅使用BasicHttpBinding绑定在IIS中使用SSL和基本身份验证设置WCF服务?(我不能使用wsHttpBinding绑定)

该站点托管在IIS 7上,并设置了以下身份验证:

   - Anonymous access: off
   - Basic authentication: on
   - Integrated Windows authentication: off !!
Run Code Online (Sandbox Code Playgroud)

服务配置:

<services>
  <service name="NameSpace.SomeService">
    <host>
      <baseAddresses>
        <add baseAddress="https://hostname/SomeService/" />
      </baseAddresses>

    </host>
    <!-- Service Endpoints -->
    <endpoint address="" binding="basicHttpBinding"
              bindingNamespace="http://hostname/SomeMethodName/1"
              contract="NameSpace.ISomeInterfaceService"
              name="Default"
                      />
    <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/>
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior>
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
      <serviceMetadata httpsGetEnabled="true"/>
      <!-- To receive exception details in faults for debugging …
Run Code Online (Sandbox Code Playgroud)

ssl wcf basichttpbinding wcf-binding wcf-security

19
推荐指数
1
解决办法
5万
查看次数

什么130秒超时正在杀死我的WCF流媒体服务电话?

就在最近,我开始研究WCF流的棘手问题,如果客户端在发送到服务器之间等待的时间超过130秒,则会产生CommunicationException.

以下是完整的例外情况:

System.ServiceModel.CommunicationException was unhandled by user code
  HResult=-2146233087
  Message=The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '23:59:59.9110000'.
  Source=mscorlib
  StackTrace:
    Server stack trace: 
       at System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.WebRequestOutputStream.Write(Byte[] buffer, Int32 offset, Int32 count)
       at System.IO.BufferedStream.Write(Byte[] array, Int32 offset, Int32 count)
       at System.Xml.XmlStreamNodeWriter.FlushBuffer()
       at System.Xml.XmlStreamNodeWriter.GetBuffer(Int32 count, Int32& offset)
       at System.Xml.XmlUTF8NodeWriter.InternalWriteBase64Text(Byte[] buffer, Int32 offset, Int32 count)
       at System.Xml.XmlBaseWriter.WriteBase64(Byte[] …
Run Code Online (Sandbox Code Playgroud)

streaming wcf iis-7 .net-4.0 basichttpbinding

15
推荐指数
1
解决办法
1万
查看次数