【发布时间】:2015-05-05 17:46:15
【问题描述】:
我已经苦苦挣扎了一个星期了,我正在尝试在 IIS express 上运行 WCF 服务并从浏览器执行 GET,在 HTTP 中一切正常,但是在我尝试 HTTPS 的那一刻失败
HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
我已经尝试了 stackoverflow 答案中的每个配置文件我也尝试了this 我知道它适用于 IIS,但我不明白为什么它在 IIS express 上不起作用。这是我的配置文件:
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5"/>
</system.web>
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<behaviors>
<endpointBehaviors>
<behavior name="webHttpEnablingBehaviour">
<webHttp />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="webHttpEnablingBehaviour">
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service
name="ElasticSearchAPI.GetElasticService" behaviorConfiguration="webHttpEnablingBehaviour">
<endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
<endpoint address=""
binding="webHttpBinding"
bindingConfiguration="default"
contract="ElasticSearchAPI.IGetElasticService"
behaviorConfiguration="webHttpEnablingBehaviour">
</endpoint>
<endpoint address="other"
binding="basicHttpBinding"
bindingConfiguration="default"
contract="ElasticSearchAPI.IGetElasticService">
</endpoint>
</service>
</services>
<client />
<bindings>
<webHttpBinding>
<binding name="default" ></binding>
</webHttpBinding>
<basicHttpBinding>
<binding name="default" allowCookies="true"></binding>
</basicHttpBinding>
</bindings>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<validation validateIntegratedModeConfiguration="false"/>
<!--
To browse web app root directory during debugging, set the value below to true.
Set to false before deployment to avoid disclosing web app folder information.
-->
<directoryBrowse enabled="true"/>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
</customHeaders>
</httpProtocol>
</system.webServer>
</configuration>
我确信我错过了一些非常愚蠢的东西,但我真的没有想法,非常感谢你的帮助。
更新
我可以使用 https 访问我的 .svc,但是当我尝试从浏览器获取或从提琴手发帖时,没有任何效果
【问题讨论】:
-
如果有人登陆此页面寻找答案,如果您的问题是 webconfig,那么stackoverflow.com/questions/26558326/… 将解决您的问题。
标签: c# wcf ssl https wcf-binding