修改启用 Silverlight 的 WCF 服务以使用 Windows 身份验证进行协作
我有一个 Silverlight 应用程序,并添加了启用 Silverlight 的 WCF 服务。我想使用 Windows 身份验证将其部署为 Intranet 解决方案,无需匿名访问。
开箱即用,WCF 服务将以下设置添加到 web.config:
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="WindowsAuthTest.Web.Service1Behavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<customBinding>
<binding name="customBinding0">
<binaryMessageEncoding />
<httpTransport />
</binding>
</customBinding>
</bindings>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<services>
<service behaviorConfiguration="WindowsAuthTest.Web.Service1Behavior"
name="WindowsAuthTest.Web.Service1">
<endpoint address="" binding="customBinding" bindingConfiguration="customBinding0"
contract="WindowsAuthTest.Web.Service1" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>
将此服务引用添加到 silverlight 项目时,这些设置将添加到 ServiceReferences.ClientConfig:
<system.serviceModel>
<bindings>
<customBinding>
<binding name="CustomBinding_Service1">
<binaryMessageEncoding />
<httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
</binding>
</customBinding>
</bindings>
<client>
<endpoint address="http://localhost:3568/Service1.svc" binding="customBinding"
bindingConfiguration="CustomBinding_Service1" contract="ServiceReference1.Service1"
name="CustomBinding_Service1" />
</client>
</system.serviceModel>
如何修改这些设置以允许其使用Windows 身份验证和是否可以?
I have a Silverlight application, and added a Silverlight-enabled WCF service. I would like to deploy this as an intranet solution using Windows authentication without anonymous access.
Out of the box, the WCF service adds the following settings to the web.config:
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="WindowsAuthTest.Web.Service1Behavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<customBinding>
<binding name="customBinding0">
<binaryMessageEncoding />
<httpTransport />
</binding>
</customBinding>
</bindings>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<services>
<service behaviorConfiguration="WindowsAuthTest.Web.Service1Behavior"
name="WindowsAuthTest.Web.Service1">
<endpoint address="" binding="customBinding" bindingConfiguration="customBinding0"
contract="WindowsAuthTest.Web.Service1" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>
When adding this service reference to the silverlight project, these settings are added to the ServiceReferences.ClientConfig:
<system.serviceModel>
<bindings>
<customBinding>
<binding name="CustomBinding_Service1">
<binaryMessageEncoding />
<httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
</binding>
</customBinding>
</bindings>
<client>
<endpoint address="http://localhost:3568/Service1.svc" binding="customBinding"
bindingConfiguration="CustomBinding_Service1" contract="ServiceReference1.Service1"
name="CustomBinding_Service1" />
</client>
</system.serviceModel>
How do I modify these settings to allow it to work with Windows authentication & is it possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试添加:
security mode="TransportCredentialOnly
例如,
在 web.config 中我们使用 basicHttpBinding 例如
Try adding:
security mode="TransportCredentialOnly
e.g.
And in the web.config we use basicHttpBinding e.g.