C# 允许WCF在Azure上通过REST HTTPS工作
我有一个基于WCF的REST web服务,正在HTTP上运行 如果我试图通过HTTPS访问它,我会得到一个404错误。我需要HTTPS才能正常工作,因为该服务将主要处理用户通过AJAX在浏览器中进行的状态更改。如果我试图用C# 允许WCF在Azure上通过REST HTTPS工作,c#,ajax,web-services,rest,azure,C#,Ajax,Web Services,Rest,Azure,我有一个基于WCF的REST web服务,正在HTTP上运行 如果我试图通过HTTPS访问它,我会得到一个404错误。我需要HTTPS才能正常工作,因为该服务将主要处理用户通过AJAX在浏览器中进行的状态更改。如果我试图用.ajax调用web服务,我会得到一个错误 http://site/svc/core.svc/dowork ==正在工作 https://site/svc/core.svc/dowork ==404 以下是基本代码: [OperationContract]
.ajax
调用web服务,我会得到一个错误
http://site/svc/core.svc/dowork ==正在工作
https://site/svc/core.svc/dowork ==404
以下是基本代码:
[OperationContract]
[WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Json)]
string DoWork();
public string DoWork()
{
return "hullo";
}
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<bindings>
<webHttpBinding>
<binding name="secureBinding">
<security mode="Transport"/>
</binding>
</webHttpBinding>
</bindings>
<protocolMapping>
<add binding="webHttpBinding" bindingConfiguration="secureBinding" scheme="https"/>
</protocolMapping>
<services>
<service name="Fusion.core" behaviorConfiguration="Fusion.CoreBehavior" >
<endpoint contract="Fusion.Icore" binding="webHttpBinding" behaviorConfiguration="webBehavior" address="" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="Fusion.CoreBehavior">
<serviceMetadata httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="webBehavior">
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
[运营合同]
[WebInvoke(Method=“GET”,ResponseFormat=WebMessageFormat.Json)]
串销();
公共字符串DoWork()
{
返回“hullo”;
}
尝试了解如何使用https在Azure上托管WCF,这可能会有所帮助(例如:)。再看一下这个问题就这么()