【发布时间】:2015-10-02 19:16:56
【问题描述】:
错误:Could not find a base address that matches scheme https for the endpoint with binding WebHttpBinding. Registered base address schemes are [http].
我已经搜索了其他答案并尝试了不同的方法,但我的网络服务仍然无法正常工作。注意:我是新手,但在开发/网络服务方面有经验。我只需要服务在 HTTPS 上运行,顺便说一句。
Web.config:
<system.serviceModel>
<bindings>
<webHttpBinding>
<binding name="bindingHTTPS" crossDomainScriptAccessEnabled="true">
<security mode="Transport">
<transport clientCredentialType="None"></transport>
</security>
</binding>
<binding name="httpbind" crossDomainScriptAccessEnabled="true"></binding>
</webHttpBinding>
</bindings>
<services>
<service name="Personnel.Personnel" behaviorConfiguration="personnelBehavior">
<endpoint address="" binding="webHttpBinding" bindingConfiguration="bindingHTTPS" contract="Personnel.IPersonnel" behaviorConfiguration="web"></endpoint>
<endpoint address="" binding="webHttpBinding" bindingConfiguration="httpbind" contract="Personnel.IPersonnel" behaviorConfiguration="web"></endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="personnelBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
<behavior>
<!-- To avoid disclosing metadata information, set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="web">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
在我添加另一种方法之前它工作正常吗?所以现在我有两种方法?在我的网络服务中:
[WebGet(UriTemplate="createOffboardTask/{resourceName}/{lastDay}/{submitter}",ResponseFormat=WebMessageFormat.Json, BodyStyle=WebMessageBodyStyle.Wrapped)]
public string createOffboardTask(string resourceName, string lastDay, string submitter)
{
//do some stuff
}
[WebGet(UriTemplate = "createOnboardTask/{resourceName}/{firstDay}/{submitter}/{itemID}", ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped)]
public string createOnboardTask(string resourceName, string firstDay, string submitter, string itemID)
{
//do some stuff
}
而且我确实在 Ifile 中有两个操作合同:
[OperationContract]
string createOffboardTask(string resourceName, string lastDay, string submitter);
[OperationContract]
string createOnboardTask(string resourceName, string firstDay, string submitter, string ID);
【问题讨论】:
-
此服务或 Web 是否托管为 HTTPS..?
标签: c# web-services wcf