找不到与https方案匹配的基地址
本文关键字:基地址 方案 https 找不到 | 更新日期: 2023-09-27 18:15:40
错误:Could not find a base address that matches scheme https for the endpoint with binding WebHttpBinding. Registered base address schemes are [http].
我已经搜索了其他答案并尝试了不同的东西,但我的web服务仍然不起作用。注:我在这方面是新的,但有开发/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>
它工作得很好,直到我添加了另一个方法?现在我有两个方法了?在我的web服务中:
[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
}
我在iffile中有两个操作契约:
[OperationContract]
string createOffboardTask(string resourceName, string lastDay, string submitter);
[OperationContract]
string createOnboardTask(string resourceName, string firstDay, string submitter, string ID);
将此添加到绑定配置中。
<security mode="Transport">
如果需要的话可以参考