繁体   English   中英

Web服务(Discovery.svc?wsdl)和Forefront TMG身份验证

[英]Web Service (Discovery.svc?wsdl) and Forefront TMG authentication

我有一个WCF服务URL,例如https://crm.xxxx.com/XRMServices/2011/Discovery.svc?wsdl 但是,如果我在浏览器窗口中打开此URL,则会得到一个授权屏幕:

TMG屏幕截图

如果尝试在我的C#代码中添加此URL,则会出现异常:

ServiceConfigurationFactory.CreateManagement<T>(new Uri(url));

例外: 元数据包含无法解析的引用:“ https://crm.xxxx.com/XRMServices/2011/Discovery.svc?wsdl ”。

要么

例外: 元数据包含无法解析的引用:“ https://crm.xxxx.com/XRMServices/2011/Organisation.svc?wsdl ”。

如果我有用户登录名和密码,如何从客户端应用程序访问Web服务?

TMG基本上是阻止您的传入请求的公司防火墙,因此您首先必须与TMG协商,然后将您的请求发送到WCF服务。

这是我从以下MSDN博客条目中获取示例绑定, 绑定处理了类似的问题:

<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="BasicHttpBinding_IService1">
                <security mode="Transport">
                    <transport clientCredentialType="Certificate" />
                   </security>
            </binding>
        </basicHttpBinding>
    </bindings>
    <client>
        <endpoint address="https://www.myservice.com/Service1.svc"
                  behaviorConfiguration="myEndpointBehaviour"
                  binding="basicHttpBinding"
                  bindingConfiguration="BasicHttpBinding_IService1"
                  contract="Client.IService1"
                  name="BasicHttpBinding_IService1" />
    </client>
    <behaviors>
        <endpointBehaviors>
            <behavior name="myEndpointBehaviour">
                <clientCredentials>
                    <clientCertificate
                        storeName="My" 
                        storeLocation="CurrentUser"
                        findValue="CN=WCF client cert 2" />
                </clientCredentials>
            </behavior>
        </endpointBehaviors>
    </behaviors>
</system.serviceModel>

如果您的服务没有启用任何消息级别的安全性,则此绑定已经可以进行。

顺便说一句,请确保您具有访问服务的正确证书,登录名和密码可能暗含消息级的安全性。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM