首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >WCF服务未与Windows8上的silverlight4应用程序通信。IE 10.IIS8.0

WCF服务未与Windows8上的silverlight4应用程序通信。IE 10.IIS8.0
EN

Stack Overflow用户
提问于 2014-03-01 20:49:45
回答 1查看 231关注 0票数 0

有两个模块,一个是silverlight应用程序(如客户端),另一个是wcf服务,它是自托管服务。在这里,应用程序的工作方式类似于客户端和服务器的通信。这两个应用程序在windows7和以前的版本中可以正常通信,但在win8中却无法正常通信。

可能会出现类似“尝试向URI "localhost:8283/MyTestService”“发出请求时出错。这可能是由于尝试以跨域方式访问服务而没有适当的跨域策略,或者是由于策略不适用于SOAP服务。您可能需要与服务的所有者联系以发布跨域策略文件,并确保它允许发送与SOAP相关的HTTP头。此错误也可能是由于在web服务代理中使用内部类型而未使用InternalsVisibleToAttribute属性造成的。有关详细信息,请参阅内部异常。”

我尝试了许多方法,我从互联网上参考,但无法在Windows8中创建它们之间的连接。

我尝试了这些方法: 1).added两个文件clientaccesspolicy.xml和crossdomain.xml到MSN引用的IIS8(wwwroot)文件夹。2).Giver各个文件夹的所有权限。

可能的解决方案是什么? 1)。任何安全问题都可能存在2)。windows 8是企业版

如果需要更多细节,请在评论中让我知道。

我期待着你的回复。

EN

回答 1

Stack Overflow用户

发布于 2014-03-04 14:03:32

经过这么多的研究和开发,我得到了在Windows8环境下工作silverlight和WCF服务的解决方案。我正在回答我的问题,它是否对任何被发现犯下这种错误的人有帮助..

实际原因:

代码语言:javascript
复制
 No communication is creating in between CVT Service(WCF service) and CVT pages(silver light application) as client side. Whenever it compiled in windows 8 environment . Then the error caught was “ An error occurred while trying to make a request to URI ‘http://localhost:8283. This could be due to attempting to access a service in a cross-domain way without a proper cross-domain policy in place, or a policy that is unsuitable for SOAP services. You may need to contact the owner of the service to publish a cross-domain policy file and to ensure it allows SOAP-related HTTP headers to be sent. Please see the inner exception for more details. “.

解决方案:

代码语言:javascript
复制
The actual problem is present in WCF service . Below steps to be followed to run the WCF service successfully and make it communicate properly with silver light application in windows 8 environment. In windows 7 and previous versions the settings related to WCF service work will be enabled by default but in win 8 few features might not be enabled in that case you can follow these below steps.

步骤1:创建两个XML文件并将其添加到wwwroot文件夹。此文件夹位于路径“C:\inetpub\wwwroot”中。

a)。clientaccesspolicy.xml:

代码语言:javascript
复制
<xml version="1.0" encoding="utf-8">
        <access-policy>
        <cross-domain-access>
         <policy>
            <allow-from http-request-headers="*">
            <domain uri="*"/>
        </allow-from>
        <grant-to>
            <resource path="/" include-subpaths="true"/>
        </grant-to>
    </policy>
    </cross-domain-access>
    </access-policy>
</xml>

b)。crossdomain.xml:

代码语言:javascript
复制
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-    policy.dtd">
<cross-domain-policy>
<allow-http-request-headers-from domain="*" headers="SOAPAction,Content-Type"/>
</cross-domain-policy>

步骤2:如果该功能未开通,请按照以下步骤开通该功能。

点击Windows+x。选择程序和功能(列表中的第一项)。选择左侧的打开或关闭Windows功能。展开.Net Framework4.5高级服务。展开WCF服务。启用HTTP激活。

步骤3:添加MIME类型和新的托管处理程序

WCF服务不能在默认配置的IIS8上运行,因为web服务器不知道如何处理针对.svc文件的传入请求。你可以通过两个步骤来教它:参考下面的链接:https://gyorgybalassy.wordpress.com/2012/09/24/

步骤4:应用程序应在windows 8环境下编译。我们需要遵循以下步骤在Windows8环境中运行此应用程序。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/22114597

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档