根據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。 –