我在IIS中配置了网站。 MVC application
是主要网站,WCF application
下配置了default web site
和default web site
。像下面的东西
default web site
正在使用Cookie身份验证使用OpenID连接身份验证。因此,当用户尝试从MVC
或其子应用程序访问任何资源时,他会被重定向到登录页面。这正如预期的那样正常。
现在我需要WCF
应用程序需要在按钮点击时从 <system.serviceModel>
<extensions>
<behaviorExtensions>
<add name="silverlightFaults" type="Framework.Wcf.SilverlightFaultBehavior, Framework, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b297de4b0f792ff8" />
</behaviorExtensions>
</extensions>
<services>
<service name="DocumentManagementService.DocumentManagementService" behaviorConfiguration="DocumentManagementServiceBehavior">
<endpoint name="BasicHttpEndPoint" binding="basicHttpBinding" contract="DocumentManagementService.Contracts.IDocumentManagement" bindingConfiguration="BasicHttpEndPoint" behaviorConfiguration="SilverlightFaultBehavior" />
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpEndPoint" closeTimeout="00:2:00" openTimeout="00:2:00" receiveTimeout="0:5:00" sendTimeout="00:5:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="104857600" maxBufferPoolSize="524288" maxReceivedMessageSize="104857600" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="104857600" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="Transport">
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="DocumentManagementServiceBehavior">
<serviceMetadata httpGetEnabled="false" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="SilverlightFaultBehavior">
<silverlightFaults />
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" />
</system.serviceModel>
服务调用操作。所以我在MVC应用程序中添加了一个服务引用,并在下面配置了绑定
WCF服务配置
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpEndPoint" closeTimeout="00:2:00" openTimeout="00:2:00" receiveTimeout="0:5:00" sendTimeout="00:5:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="104857600" maxBufferPoolSize="524288" maxReceivedMessageSize="104857600" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="104857600" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="Transport">
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="https://XXXXX/DocumentManagementService/DocumentManagementService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpEndPoint"
contract="DMProxy.IDocumentManagement" name="BasicHttpEndPoint" />
</client>
</system.serviceModel>
MVC配置(这是客户端)
UntypedConsumerActor
但是当我调用WCF操作时出现错误
HTTP请求未经授权使用客户端身份验证方案 '匿名'。从服务器收到的身份验证标头是 ''。
请注意,当用户点击某个按钮时,此时他已经过身份验证。我不确定如何将身份验证传递给WCF应用程序。
更新1
默认网站的IIS身份验证
WCF的IIS认证
更新2 我想*我需要在进行WCF调用之前在Cookies和HttpHeader中添加身份验证cookie。 ??知道我该怎么做