C# 如何使用basicHttp绑定启用帮助页?
我试图为basicHttpBinding启用帮助页面,但出现以下错误C# 如何使用basicHttp绑定启用帮助页?,c#,wcf,binding,web-config,wcf-binding,C#,Wcf,Binding,Web Config,Wcf Binding,我试图为basicHttpBinding启用帮助页面,但出现以下错误 The endpoint at 'http://localhost:52568/address.svc/ws' does not have a Binding with the None MessageVersion. 'System.ServiceModel.Description.WebHttpBehavior' is only intended for use with WebHttpBinding or simila
The endpoint at 'http://localhost:52568/address.svc/ws' does not have a Binding with the None MessageVersion. 'System.ServiceModel.Description.WebHttpBehavior' is only intended for use with WebHttpBinding or similar bindings.
<service behaviorConfiguration="MyServiceBehavior" name="MCDThirdPartyService.Store">
<endpoint address="ms" binding="basicHttpBinding" contract="MCDThirdPartyService.IStore" behaviorConfiguration="MDS_Service.LoginAspNetAjaxBehavior"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
<service behaviorConfiguration="MyServiceBehavior" name="MCDThirdPartyService.address">
<endpoint address="ws" binding="basicHttpBinding" contract="MCDThirdPartyService.Iaddress" behaviorConfiguration="MDS_Service.LoginAspNetAjaxBehavior"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
<service behaviorConfiguration="MyServiceBehavior" name="MCDThirdPartyService.Configuration">
<endpoint address="ws" binding="basicHttpBinding" contract="MCDThirdPartyService.IConfiguration" behaviorConfiguration="MDS_Service.LoginAspNetAjaxBehavior" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
<service behaviorConfiguration="MyServiceBehavior" name="MCDThirdPartyService.Order">
<endpoint address="ws" binding="basicHttpBinding" contract="MCDThirdPartyService.IOrder" behaviorConfiguration="MDS_Service.LoginAspNetAjaxBehavior" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" minFreeMemoryPercentageToActivateService="0" aspNetCompatibilityEnabled="true"/>
<behaviors>
<endpointBehaviors>
<behavior name="MDS_Service.LoginAspNetAjaxBehavior">
<webHttp helpEnabled="true"/>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="MyServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceThrottling maxConcurrentCalls="100" maxConcurrentInstances="100" maxConcurrentSessions="100" />
</behavior>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
我猜上面的错误是因为
仅用于webHttp绑定
<service behaviorConfiguration="MyServiceBehavior" name="MCDThirdPartyService.Store">
<endpoint address="ms" binding="basicHttpBinding" contract="MCDThirdPartyService.IStore" behaviorConfiguration="MDS_Service.LoginAspNetAjaxBehavior"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
<service behaviorConfiguration="MyServiceBehavior" name="MCDThirdPartyService.address">
<endpoint address="ws" binding="basicHttpBinding" contract="MCDThirdPartyService.Iaddress" behaviorConfiguration="MDS_Service.LoginAspNetAjaxBehavior"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
<service behaviorConfiguration="MyServiceBehavior" name="MCDThirdPartyService.Configuration">
<endpoint address="ws" binding="basicHttpBinding" contract="MCDThirdPartyService.IConfiguration" behaviorConfiguration="MDS_Service.LoginAspNetAjaxBehavior" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
<service behaviorConfiguration="MyServiceBehavior" name="MCDThirdPartyService.Order">
<endpoint address="ws" binding="basicHttpBinding" contract="MCDThirdPartyService.IOrder" behaviorConfiguration="MDS_Service.LoginAspNetAjaxBehavior" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" minFreeMemoryPercentageToActivateService="0" aspNetCompatibilityEnabled="true"/>
<behaviors>
<endpointBehaviors>
<behavior name="MDS_Service.LoginAspNetAjaxBehavior">
<webHttp helpEnabled="true"/>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="MyServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceThrottling maxConcurrentCalls="100" maxConcurrentInstances="100" maxConcurrentSessions="100" />
</behavior>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
现在我真正需要的是为basicHttpBinding启用帮助页面。如何实现
<service behaviorConfiguration="MyServiceBehavior" name="MCDThirdPartyService.Store">
<endpoint address="ms" binding="basicHttpBinding" contract="MCDThirdPartyService.IStore" behaviorConfiguration="MDS_Service.LoginAspNetAjaxBehavior"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
<service behaviorConfiguration="MyServiceBehavior" name="MCDThirdPartyService.address">
<endpoint address="ws" binding="basicHttpBinding" contract="MCDThirdPartyService.Iaddress" behaviorConfiguration="MDS_Service.LoginAspNetAjaxBehavior"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
<service behaviorConfiguration="MyServiceBehavior" name="MCDThirdPartyService.Configuration">
<endpoint address="ws" binding="basicHttpBinding" contract="MCDThirdPartyService.IConfiguration" behaviorConfiguration="MDS_Service.LoginAspNetAjaxBehavior" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
<service behaviorConfiguration="MyServiceBehavior" name="MCDThirdPartyService.Order">
<endpoint address="ws" binding="basicHttpBinding" contract="MCDThirdPartyService.IOrder" behaviorConfiguration="MDS_Service.LoginAspNetAjaxBehavior" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" minFreeMemoryPercentageToActivateService="0" aspNetCompatibilityEnabled="true"/>
<behaviors>
<endpointBehaviors>
<behavior name="MDS_Service.LoginAspNetAjaxBehavior">
<webHttp helpEnabled="true"/>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="MyServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceThrottling maxConcurrentCalls="100" maxConcurrentInstances="100" maxConcurrentSessions="100" />
</behavior>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
这是我的密码
<?xml version="1.0"?>
<service behaviorConfiguration="MyServiceBehavior" name="MCDThirdPartyService.Store">
<endpoint address="ms" binding="basicHttpBinding" contract="MCDThirdPartyService.IStore" behaviorConfiguration="MDS_Service.LoginAspNetAjaxBehavior"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
<service behaviorConfiguration="MyServiceBehavior" name="MCDThirdPartyService.address">
<endpoint address="ws" binding="basicHttpBinding" contract="MCDThirdPartyService.Iaddress" behaviorConfiguration="MDS_Service.LoginAspNetAjaxBehavior"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
<service behaviorConfiguration="MyServiceBehavior" name="MCDThirdPartyService.Configuration">
<endpoint address="ws" binding="basicHttpBinding" contract="MCDThirdPartyService.IConfiguration" behaviorConfiguration="MDS_Service.LoginAspNetAjaxBehavior" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
<service behaviorConfiguration="MyServiceBehavior" name="MCDThirdPartyService.Order">
<endpoint address="ws" binding="basicHttpBinding" contract="MCDThirdPartyService.IOrder" behaviorConfiguration="MDS_Service.LoginAspNetAjaxBehavior" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" minFreeMemoryPercentageToActivateService="0" aspNetCompatibilityEnabled="true"/>
<behaviors>
<endpointBehaviors>
<behavior name="MDS_Service.LoginAspNetAjaxBehavior">
<webHttp helpEnabled="true"/>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="MyServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceThrottling maxConcurrentCalls="100" maxConcurrentInstances="100" maxConcurrentSessions="100" />
</behavior>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<service behaviorConfiguration="MyServiceBehavior" name="MCDThirdPartyService.Store">
<endpoint address="ms" binding="basicHttpBinding" contract="MCDThirdPartyService.IStore" behaviorConfiguration="MDS_Service.LoginAspNetAjaxBehavior"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
<service behaviorConfiguration="MyServiceBehavior" name="MCDThirdPartyService.address">
<endpoint address="ws" binding="basicHttpBinding" contract="MCDThirdPartyService.Iaddress" behaviorConfiguration="MDS_Service.LoginAspNetAjaxBehavior"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
<service behaviorConfiguration="MyServiceBehavior" name="MCDThirdPartyService.Configuration">
<endpoint address="ws" binding="basicHttpBinding" contract="MCDThirdPartyService.IConfiguration" behaviorConfiguration="MDS_Service.LoginAspNetAjaxBehavior" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
<service behaviorConfiguration="MyServiceBehavior" name="MCDThirdPartyService.Order">
<endpoint address="ws" binding="basicHttpBinding" contract="MCDThirdPartyService.IOrder" behaviorConfiguration="MDS_Service.LoginAspNetAjaxBehavior" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" minFreeMemoryPercentageToActivateService="0" aspNetCompatibilityEnabled="true"/>
<behaviors>
<endpointBehaviors>
<behavior name="MDS_Service.LoginAspNetAjaxBehavior">
<webHttp helpEnabled="true"/>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="MyServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceThrottling maxConcurrentCalls="100" maxConcurrentInstances="100" maxConcurrentSessions="100" />
</behavior>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
在用户端提供帮助,而不是在客户端启用帮助页面?但我的想法是,我这边需要帮助页面。有可能吗?我不这么认为,但您可以启用跟踪和消息日志记录。但是跟踪和消息日志记录不会提供API列表,而是在您的消费者端提供帮助功能。您是说在客户端启用帮助页面?但我的想法是,我这边需要帮助页面。有可能吗?我不这么认为,但你可以启用跟踪和消息记录。但是跟踪和消息记录不会给出API列表
<service behaviorConfiguration="MyServiceBehavior" name="MCDThirdPartyService.Store">
<endpoint address="ms" binding="basicHttpBinding" contract="MCDThirdPartyService.IStore" behaviorConfiguration="MDS_Service.LoginAspNetAjaxBehavior"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
<service behaviorConfiguration="MyServiceBehavior" name="MCDThirdPartyService.address">
<endpoint address="ws" binding="basicHttpBinding" contract="MCDThirdPartyService.Iaddress" behaviorConfiguration="MDS_Service.LoginAspNetAjaxBehavior"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
<service behaviorConfiguration="MyServiceBehavior" name="MCDThirdPartyService.Configuration">
<endpoint address="ws" binding="basicHttpBinding" contract="MCDThirdPartyService.IConfiguration" behaviorConfiguration="MDS_Service.LoginAspNetAjaxBehavior" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
<service behaviorConfiguration="MyServiceBehavior" name="MCDThirdPartyService.Order">
<endpoint address="ws" binding="basicHttpBinding" contract="MCDThirdPartyService.IOrder" behaviorConfiguration="MDS_Service.LoginAspNetAjaxBehavior" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" minFreeMemoryPercentageToActivateService="0" aspNetCompatibilityEnabled="true"/>
<behaviors>
<endpointBehaviors>
<behavior name="MDS_Service.LoginAspNetAjaxBehavior">
<webHttp helpEnabled="true"/>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="MyServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceThrottling maxConcurrentCalls="100" maxConcurrentInstances="100" maxConcurrentSessions="100" />
</behavior>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>