내 컴퓨터에서 WCF restfull 서비스를 개발 중이며 HTTP 서비스 끝점에 도달하면 서비스가 예상대로 응답했습니다. 그러나 HTTPS 끝점을 클릭하면 404 찾을 수 없습니다.webHttpBinding WCF 서비스가 HTTPS는 응답하지만 HTTPS는 응답하지 않습니다.
는에서 HTTPS 호출이 작동하지 않는 이유 serviceAuthorizationManagerType
어떤 생각으로 구현 된 CustomAuthorizationManager
을 발생하지 않습니다 ? 기본 주소가 HTTPS 일 때 HTTP 트래픽을 허용하는 이유는 무엇입니까?
HTTP 응답
HTTPS 응답
의 Web.config
<system.serviceModel>
<bindings>
<webHttpBinding>
<binding name="webHttpTransportSecurity">
<security mode="TransportCredentialOnly">
<!--Basic authentication is NOT supported when running webHttpBinding through IIS
see - http://blogs.msdn.com/b/phenning/archive/2008/01/11/custom-usernamepassword-validators-in-net-framework-3-5.aspx
and a resolution - http://allen-conway-dotnet.blogspot.co.uk/2012/07/using-basic-authentication-in-rest.html-->
<transport clientCredentialType="None"/>
</security>
</binding>
</webHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="restfulBehavior" name="Chubb.SurveyRecommendations.Service.SurveyRecommendationsService">
<!--webHttpBinding allows exposing service methods in a RESTful manner-->
<endpoint address="" binding="webHttpBinding" bindingConfiguration="webHttpTransportSecurity" behaviorConfiguration="webHttpBehavior" contract="Chubb.SurveyRecommendations.Service.ISurveyRecommendations"/>
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/>
<host>
<baseAddresses>
<add baseAddress="https://localhost:44300/"/>
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="restfulBehavior">
<serviceMetadata httpGetEnabled="false" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
<serviceAuthorization serviceAuthorizationManagerType="Chubb.SurveyRecommendations.Service.Security.CustomAuthorizationManager, Chubb.SurveyRecommendations.Service"/>
</behavior>
</serviceBehaviors>
<!--Required default endpoint behavior when using webHttpBinding-->
<endpointBehaviors>
<behavior name="webHttpBehavior">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
계약
[OperationContract]
[WebGet(UriTemplate = "Echo/{value}", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Xml, ResponseFormat = WebMessageFormat.Xml)]
string Echo(string value);
서비스
public class SurveyRecommendationsService : ISurveyRecommendations
{
public string Echo(string value)
{
if (string.IsNullOrWhiteSpace(value))
return string.Empty;
return value;
}
}