首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >需要通过http设置WCF

需要通过http设置WCF
EN

Stack Overflow用户
提问于 2010-04-05 00:10:59
回答 3查看 1.7K关注 0票数 0

我们目前有一个工作在https上的WCF服务。但我们希望将其更改为仅在http上工作。

谁能告诉我,我需要做哪些更改才能使wcf服务在http上工作。下面是我的配置文件值。除了web.config,我还需要处理其他什么吗??

非常感谢ANy的帮助

代码语言:javascript
复制
<system.serviceModel>
   <serviceHostingEnvironment>
      <baseAddressPrefixFilters>
        <add prefix="myservername" />
      </baseAddressPrefixFilters>
    </serviceHostingEnvironment>
    <bindings>
      <basicHttpBinding>
          <binding name="basicHttpBinding_Windows" 
              maxReceivedMessageSize="500000000"  maxBufferPoolSize="500000000" 
              messageEncoding="Mtom">
              <security mode="TransportWithMessageCredential">
                 <transport clientCredentialType="Windows" />
              </security>
              <readerQuotas maxDepth="500000000"
                 maxArrayLength="500000000" maxBytesPerRead="500000000"
                 maxNameTableCharCount="500000000" maxStringContentLength="500000000"/>
          </binding>
      </basicHttpBinding>
    </bindings>
    <behaviors>
       <endpointBehaviors>
         <behavior name="myproject_Behavior">
            <dataContractSerializer />
            <synchronousReceive />
         </behavior>
       </endpointBehaviors>
       <serviceBehaviors>
          <behavior name="WebService.WSBehavior">
             <serviceMetadata httpsGetEnabled="true" />
             <serviceDebug includeExceptionDetailInFaults="true" />
          </behavior>
          <behavior name="WebService.Forms_WSBehavior">
              <serviceMetadata httpGetEnabled="true" />
              <serviceDebug includeExceptionDetailInFaults="false" />
          </behavior>
       </serviceBehaviors>
    </behaviors>
    <services>
       <service behaviorConfiguration="WebService.WSBehavior"
                name="IMMSWebService.mywebservice_WS">
           <endpoint 
               address="myproject_WS" 
               binding="basicHttpBinding" 
               bindingConfiguration="basicHttpBinding_Windows"
               bindingName="basicHttpBinding" 
               contract="WebService.ICommand">
               <identity>
                  <dns value="localhost" />
               </identity>
           </endpoint>
           <endpoint address="mex" 
                     binding="mexHttpsBinding" 
                     contract="IMetadataExchange" />
           <host>
              <timeouts closeTimeout="00:10:00" openTimeout="00:10:00" />
           </host>
       </service>
       <service behaviorConfiguration="WebService.Forms_WSBehavior"
                name="WebService.Forms_WS">
           <endpoint 
                address="" 
                binding="wsHttpBinding" 
                contract="WebService.IForms_WS">
                <identity>
                   <dns value="localhost" />
                </identity>
           </endpoint>
           <endpoint address="mex" 
                     binding="mexHttpBinding" 
                     contract="IMetadataExchange" />
       </service>
    </services>
  </system.serviceModel>
EN

回答 3

Stack Overflow用户

发布于 2010-04-05 00:18:12

变化

代码语言:javascript
复制
  <security mode="TransportWithMessageCredential">

代码语言:javascript
复制
  <security mode="None">

也会改变

代码语言:javascript
复制
<endpoint address="mex" 
                 binding="mexHttpsBinding" 
                 contract="IMetadataExchange" />

代码语言:javascript
复制
  <endpoint address="mex"
              binding="mexHttpBinding"
              contract="IMetadataExchange" />

最后,任何

httpsGetEnabled到httpGetEnabled

票数 0
EN

Stack Overflow用户

发布于 2010-04-05 03:20:35

我将我的配置文件更改为NOne,当我尝试从IE访问服务时,收到此错误消息:找不到与绑定了basicHttpBinding的端点的方案http匹配的基地址。注册的基址方案是https。关于下一步该怎么做,有什么帮助吗?

票数 0
EN

Stack Overflow用户

发布于 2010-04-05 04:10:49

对于基地址的第二个问题:在服务标签中创建一个<baseAddresses>元素:

代码语言:javascript
复制
<services>
  <service behaviorConfiguration="WebService.WSBehavior"
    name="IMMSWebService.mywebservice_WS">
    <endpoint 
        address="myproject_WS" 
        binding="basicHttpBinding" 
        bindingConfiguration="basicHttpBinding_Windows"
        bindingName="basicHttpBinding" 
        contract="WebService.ICommand">
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
    <host>
      <baseAddresses> 
         <add baseAddress="http://yourserver:8181/YourServiceBase" />
      </baseAddresses>
      <timeouts closeTimeout="00:10:00" openTimeout="00:10:00" />
    </host>
  </service>

或者在端点上使用完全限定的地址。

代码语言:javascript
复制
<services>
  <service behaviorConfiguration="WebService.WSBehavior"
    name="IMMSWebService.mywebservice_WS">
    <endpoint 
        address="http://yourserver:8181/YourServiceBase/myproject_WS" 
        binding="basicHttpBinding" 
        bindingConfiguration="basicHttpBinding_Windows"
        bindingName="basicHttpBinding" 
        contract="WebService.ICommand">
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
    <host>
      <timeouts closeTimeout="00:10:00" openTimeout="00:10:00" />
    </host>
  </service>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/2575019

复制
相关文章

相似问题

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