У меня есть веб-приложение, в которое пользователи входят, используя аутентификацию ASP.NET Forms. В веб-приложении есть приложение Silverlight. Приложение Silverlight вызывает веб-службу WCF на том же сервере. Служба WCF не разрешает анонимный доступ, поэтому каждая функция службы имеет:
[PrincipalPermission(SecurityAction.Demand, Authenticated = true)]
Все это работает, когда я развертываюсь в IIS и использую HTTP.
Однако я хочу использовать SSL, поэтому я пытаюсь настроить это. Я создал веб-сайт в IIS с привязкой https. Я могу войти на сайт, используя https и ASP.NET Forms Authentication. Я могу загрузить приложение Silverlight, но когда Silverlight пытается вызвать веб-службы WCF (на том же сервере в разделе / Services), я получаю отказ в доступе (я не получал этого при использовании http).
Страницы Aspx находятся в корне, файлы .svc находятся в / Services, изображения в / Img и .css в / Styles
Мой web.config:
<location path="Img">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
<location path="Styles">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
<location path="Services">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
<system.web>
<authentication mode="Forms">
<forms name=".COOKIEDEMO"
loginUrl="~/Login.aspx"
protection="All"
timeout="30"
path="/"/>
</authentication>
<authorization>
<deny users="?" />
</authorization>
<compilation strict="true" debug="true" explicit="true" targetFramework="4.0" />
<!-- Customizing the membership provider-->
<membership defaultProvider="SaverpMesProvider" userIsOnlineTimeWindow="30">
<providers>
<add name="SaverpMesProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="LocalSqlServer" applicationName="SaverpMES" />
</providers>
</membership>
<roleManager enabled="true" defaultProvider="SaverpMesRoleProvider">
<providers>
<add name="SaverpMesRoleProvider"
connectionStringName="LocalSqlServer"
applicationName="SaverpMes"
type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
</providers>
</roleManager>
<profile inherits="SaverpMes.Web.MesProfile" defaultProvider="SaverpMesProfileProvider">
<providers>
<add name="SaverpMesProfileProvider"
connectionStringName="LocalSqlServer"
applicationName="SaverpMes"
type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
</providers>
</profile>
</system.web>
<system.serviceModel>
<bindings>
<customBinding>
<binding name="CustomBinaryBinding">
<binaryMessageEncoding/>
<httpsTransport/>
</binding>
</customBinding>
</bindings>
<extensions>
<behaviorExtensions>
<add name="silverlightFaultExtension" type="SaverpMes.Web.Wcf.SilverlightFaultBehavior, SaverpMes.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
<add name="wcfFaultExtension" type="SaverpMes.Web.Wcf.WcfFaultBehaviorExtensionElement, SaverpMes.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
</behaviorExtensions>
</extensions>
<services>
<service behaviorConfiguration="ServiceBehavior" name="Product.FrontEnd.WcfService.ProductService">
<endpoint address="" behaviorConfiguration="SilverlightFaultsBehavior"
binding="customBinding" bindingConfiguration="CustomBinaryBinding"
name="ProductServiceEndpoint" contract="Product.FrontEnd.Contract.IProductService" />
</service>
<service behaviorConfiguration="ServiceBehavior" name="Product.FrontEnd.WcfService.PublicProductService">
<endpoint address="" behaviorConfiguration="SilverlightFaultsBehavior"
binding="customBinding" bindingConfiguration="CustomBinaryBinding"
name="PublicProductServiceEndpoint" contract="Product.SG.IPublicProductService" />
</service>
<service behaviorConfiguration="ServiceBehavior" name="Identification.FrontEnd.WcfService.FrontEndService">
<endpoint address="" behaviorConfiguration="SilverlightFaultsBehavior"
binding="customBinding" bindingConfiguration="CustomBinaryBinding"
name="IdentificationServcieEndpoint" contract="Identification.FrontEnd.Contract.IFrontEndService" />
</service>
<service behaviorConfiguration="ServiceBehavior" name="Common.WcfService.CommonService">
<endpoint address="" behaviorConfiguration="SilverlightFaultsBehavior"
binding="customBinding" bindingConfiguration="CustomBinaryBinding"
name="CommonServiceEndpoint" contract="Common.Contract.ICommonService" />
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="SilverlightFaultsBehavior">
<silverlightFaultExtension/>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceMetadata httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<wcfFaultExtension/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true"/>
</system.serviceModel>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
</system.webServer>
В основном, я изменил в web.config между веб-сайтом http и https один: httpsTransport в customBinding и httpsGetEnabled в serviceMetadata.
Любые идеи высоко ценятся!