WPF客户端-WCF允许跨域访问-问题 [英] WPF Client - WCF allow cross-domain access - Issue

查看:276
本文介绍了WPF客户端-WCF允许跨域访问-问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我真的很努力与此.我已经Google对此进行了尝试,并尝试了大多数解决方案,但均未获得成功.

一些背景信息:

我有一个使用WCF服务的WPF应用程序.如果服务和应用程序在同一域中,则一切正常,但是将应用程序移至另一个域后,它将立即停止运行并给出以下错误:

由于身份验证失败,无法满足对安全令牌的请求.

我浏览了以下文章:使服务跨域边界可用 [ ^ ],这是指我使用了一些XML文件,我尝试将XML文件(clientaccesspolicy.xml和crossdomain.xml)放置在IIS服务器上-这没有任何区别(请注意,我做了将文件放在Web服务的根目录中??

我可以通过在浏览器中输入URL以及单击wsdl链接并查看XML来访问Web服务(客户端),但是我无法在WPF应用程序中使它正常工作!

这是我的客户端配置文件内容:

Hi all,

I am really struggling with this one. I have Google''d this and tried most of the solutions without any success.

Some background information:

I have a WPF application which consumes a WCF service. Everything works fine if the service and the application is on the same domain, but as soon as you move the application to another domain, it stops wokiring and gives the following error:

The request for security token could not be satisfied because authentication failed.

I worked through the following article: Making a Service Available Across Domain Boundaries[^], which referred to making use of some XML files, which I did, I have tried placing the XML files (clientaccesspolicy.xml and crossdomain.xml) on the IIS server - this did not make any difference (please note that I did place the files within the root of the web service)?!

I can access the web service (client side), by entering the URL in the browser as well as click on the wsdl link and view the XML, but I cannot get it working from my WPF application!

This is my client side config file content:

<system.serviceModel>
    <bindings>
        <wsHttpBinding>
            <binding name="WSHttpBinding_IManagmentService" closeTimeout="00:01:00"

                openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"

                bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"

                maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"

                messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"

                allowCookies="false">
                <readerQuotas maxDepth="32" maxStringContentLength="2147483647"

                    maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
                <reliableSession ordered="true" inactivityTimeout="00:10:00"

                    enabled="false" />
                <security mode="Message">
                    <transport clientCredentialType="Windows" proxyCredentialType="None"

                        realm="" />
                    <message clientCredentialType="Windows" negotiateServiceCredential="true"

                        algorithmSuite="Default" />
                </security>
            </binding>
        </wsHttpBinding>
    </bindings>
    <client>
        <endpoint address="http://server.local/ManagementDataProvider/ManagmentService.svc"

            binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IManagmentService"

            contract="ManagementService.IManagmentService" name="WSHttpBinding_IManagmentService">
            <identity>
                <dns value="localhost" />
            </identity>
        </endpoint>
    </client>
</system.serviceModel>



任何人都可以向我提供一些有关如何从我的应用程序访问Web服务的信息.

提前非常感谢!
亲切的问候,



Could anyone please provide me with some information of how I can access the web service from my application.

Many thanks in advance!
Kind regards,

推荐答案

如果您使用Windows安全性进行绑定(从安全标记中可以明显看出),则可能必须信任"调用者域与您的服务的域.或者,您可以使用其他安全模式.
If you are using Windows Security for your binding (as evident from your security tag), you may have to "trust" the caller''s domain with your service''s domain. Alternatively, you can use a different security mode.


MSDN-安全服务和客户端 [^ ]


这篇关于WPF客户端-WCF允许跨域访问-问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆