错误:Could not find a base address that matches scheme https for the endpoint with binding WebHttpBinding. Registered base address schemes are [http].
我搜索了其他答案并尝试了不同的东西,但我的网络服务仍无法正常工作。注意:我是新手,但有dev / web服务经验。我只需要在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);