Não tenho a certeza se isto devia estar aqui ou na secção de redes, mas como o objectivo é configurar o webservice pareceu-me mais correcto aqui.
Tenho um webservice Restfull, configurado e a funcionar perfeitamente no IIS 7.5. Mas agora preciso passar o Webservice para https, de forma a garantir a segurança da comunicação. Mas aqui é que a porca torce o rabo :S Parece que não consigo acertar com as configurações nem a tiro...
Já alterei o web.config, e tenho a binding para https no IIS, mas ao tentar aceder obtenho falha na autenticação (403.7 ). Faço o teste apartir do meu PC com o fiddler, e obtenho o mesmo, apesar de ter colocado o certificado no sítio indicado.
Vejo montes de configurações, todas diferentes, mas nenhuma se parece enquadrar no que eu quero: Este é o meu Web.Config:
Código (ASP):
<configuration>
<system.web>
<compilation targetFramework="4.0" />
</system.web>
<system.serviceModel>
<bindings>
<webHttpBinding>
<binding name="Mybinding" maxReceivedMessageSize="900000" maxBufferSize="900000" >
<security mode="Transport" >
<transport clientCredentialType="Certificate" />
</security>
</binding>
</webHttpBinding>
</bindings>
<services>
<!-- The name of the service -->
<service name="MyLibrary.IMyInterface">
<!-- you can leave the address blank or specify your end point URI -->
<endpoint address="" binding="webHttpBinding" bindingConfiguration="Mybinding" contract="MyLibrary.IMyInterface">
</endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpsGetEnabled="true" />
<dataContractSerializer maxItemsInObjectGraph="500000"/>
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="300000000" maxQueryString="500000" >
<headerLimits>
<add header="Content" sizeLimit="500000000" />
</headerLimits>
</requestLimits>
</requestFiltering>
</security>
</system.webServer>
</configuration>
<system.web>
<compilation targetFramework="4.0" />
</system.web>
<system.serviceModel>
<bindings>
<webHttpBinding>
<binding name="Mybinding" maxReceivedMessageSize="900000" maxBufferSize="900000" >
<security mode="Transport" >
<transport clientCredentialType="Certificate" />
</security>
</binding>
</webHttpBinding>
</bindings>
<services>
<!-- The name of the service -->
<service name="MyLibrary.IMyInterface">
<!-- you can leave the address blank or specify your end point URI -->
<endpoint address="" binding="webHttpBinding" bindingConfiguration="Mybinding" contract="MyLibrary.IMyInterface">
</endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpsGetEnabled="true" />
<dataContractSerializer maxItemsInObjectGraph="500000"/>
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="300000000" maxQueryString="500000" >
<headerLimits>
<add header="Content" sizeLimit="500000000" />
</headerLimits>
</requestLimits>
</requestFiltering>
</security>
</system.webServer>
</configuration>
Falta-me alguma coisa na security? Tenho de dizer qual é o certificado que vai ser usado, ou isso fica a cargo do IIS?
Editado por Flinger, 13 de Julho de 2012 - 09:23.











