我们目前有一个适用于https的WCF服务。但是我们想要改变它以使其仅适用于http。
任何人都可以告诉我我需要做些什么才能使wcf服务通过http工作。以下是我的配置文件值。除了web.config ??
之外,我还有什么需要改变的吗?ANy非常感谢
<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>
答案 0 :(得分:0)
更改
<security mode="TransportWithMessageCredential">
到
<security mode="None">
同时更改
<endpoint address="mex"
binding="mexHttpsBinding"
contract="IMetadataExchange" />
到
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
最后出现
httpsGetEnabled到httpGetEnabled
答案 1 :(得分:0)
我将配置文件更改为NOne,当我尝试从IE获取服务时,我收到此错误无法找到与绑定basicHttpBinding的端点的scheme http匹配的基址。注册的基地址方案是[https]。关于下一步该怎么做的任何帮助
答案 2 :(得分:0)
对于基地址的第二个问题:在服务标记中创建<baseAddresses>
元素:
<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>
或在端点上使用完全限定的地址
<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>