根据wisdom of the Internet,如果我打算将我的网站托管为东西(例如我),则安全模式已被激活。但是,当我拨打下面的(1)时,我得到404 - 资源找不到,而(2)的调用导致预期的行为。这两行之间的唯一区别是协议的安全级别(复制粘贴它两次!),所以我质疑提供的链接的真实性。如何启用我的Azure网站作为https而不是http?
我能做些什么?
但是,我也注意到:
给我常用的部位,这样可能与在方法定义本身事做。它看起来有点像这样。
namespace One-of-my
{
[ServiceContract(Namespace = "")]
[AspNetCompatibilityRequirements(RequirementsMode
= AspNetCompatibilityRequirementsMode.Allowed)]
public class SomeService
{
[OperationContract]
[WebGet(
UriTemplate = "Tester/{blopp}",
ResponseFormat = WebMessageFormat.Json)]
public async Task<String> Tester(String blopp) { ... }
}
}
我的配置如下所示。第一个system.serviceModel。
<system.serviceModel>
<services>
<service name="MySite.MyService">
<endpoint address=""
behaviorConfiguration="MySite.MyServiceAspNetAjaxBehavior"
binding="webHttpBinding"
contract="MySite.MyService" />
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="MySite.MyServiceAspNetAjaxBehavior">
<webHttp/>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata
httpGetEnabled="true"
httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true" />
</system.serviceModel>
这里,system.webServer。
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
<add
name="Access-Control-Allow-Methods"
value="GET,POST,DELETE,HEAD,PUT,OPTIONS" />
<add
name="Access-Control-Allow-Headers"
value="X-Olaround-Debug-Mode, Authorization, Accept" />
<add
name="Access-Control-Expose-Headers"
value="X-Olaround-Debug-Mode, X-Olaround-Request-Start-Timestamp,
X-Olaround-Request-End-Timestamp, X-Olaround-Request-Time,
X-Olaround-Request-Method, X-Olaround-Request-Result,
X-Olaround-Request-Endpoint" />
</customHeaders>
</httpProtocol>
<modules runAllManagedModulesForAllRequests="true"/>
<directoryBrowse enabled="true"/>
</system.webServer>
你能告诉我们你的WCF服务配置从web.config? – b2zw2a
@plentysmart是的。请查看原始帖子中的修改。 –
@plentysmart除了上面显示的添加,我也感觉到[这个答案](http://stackoverflow.com/a/16387355/1525840)触及我的问题。但是,我不知道如何使用它,因为我不在使用服务器的设置,因为我使用的是Azure。 –