积极答复者
显示不出来了,急,急,急

问题
答案
-
1.cross domain通常是指web client与web service部署在不同的服务器上,或客户端程序与服务端程序采用了不同的端口号。
2.cross-domain policy文件准予web client(例如:Adobe Flash Player,silverlight)有权限跨域(如:第三方的远程服务)处理数据,通常我们只须要"clientaccesspolicy.xml"与"crossdomain.xml"文件中的一个,silverlight首先请求clientaccesspolicy.xml文件,如果没有找到该文件,就会检查crossdomain.xml文件是否存在,我们通常将crossdomain.xml or clientaccesspolicy.xml文件放在web server的根目录下面.你可以参考下面这篇英文文章: http://www.devtoolshed.com/explanation-cross-domain-and-client-access-policy-files-silverlight
3.你好像有两不同的服务契约吧,ChartsService.ChartsService与MyChartsService.ChartsService,默认为每个WCF服务地址分配一个随机的端口号。
Please mark the replies as answers if they help or unmark if not. If you have any feedback about my replies, please contact msdnmg@microsoft.com Microsoft One Code Framework
- 已编辑 Peter pi - MSFTModerator 2012年3月26日 4:02
- 已标记为答案 Peter pi - MSFTModerator 2012年3月30日 7:50
全部回复
-
准确来讲:
“Silverlight”访问不到部署在“IIS6”上的“WCF Servcie服务”。准确来讲:
“Silverlight”访问不到部署在“IIS6”上的“WCF Servcie服务”。“跨域访问文件”加上了,clientaccesspolicy.xml:
<?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>
文件加上了啊,但是提示错误信息如下:
网页错误详细信息
用户代理: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; InfoPath.3; Zune 4.7; .NET CLR 1.1.4322)
时间戳: Sat, 24 Mar 2012 06:10:29 UTC
消息: Unhandled Error in Silverlight Application 操作过程中出现异常,结果无效。有关异常的详细信息,请查看 InnerException。 位于 System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary()
位于 MyCharts.MyChartsService.GetWaterMonitoringDatasCompletedEventArgs.get_Result()
位于 MyCharts.WaterMonitoring.client_GetWaterMonitoringDatasCompleted(Object sender, GetWaterMonitoringDatasCompletedEventArgs e)
位于 MyCharts.MyChartsService.ChartsServiceClient.OnGetWaterMonitoringDatasCompleted(Object state)
行: 1
字符: 1
代码: 0
URI: http://10.10.233.120/Tj/Web/WaterMonitoring.aspx
有精到广,做出自己的特色。
- 已编辑 starrycheng 2012年3月24日 6:17
-
EndPoint”是VS2010自动生成的:
Silverlight客户端:
<configuration>
<system.serviceModel>
<bindings>
<customBinding>
<binding name="CustomBinding_ChartsService">
<binaryMessageEncoding />
<httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
</binding>
<binding name="CustomBinding_ChartsService1">
<binaryMessageEncoding />
<httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
</binding>
</customBinding>
</bindings>
<client>
<endpoint address="http://localhost:2686/Mycems.UI/ChartsService.svc"
binding="customBinding" bindingConfiguration="CustomBinding_ChartsService"
contract="ChartsService.ChartsService" name="CustomBinding_ChartsService" />
<endpoint address="http://localhost:4707/Mycems.UI/ChartsService.svc"
binding="customBinding" bindingConfiguration="CustomBinding_ChartsService1"
contract="MyChartsService.ChartsService" name="CustomBinding_ChartsService1" />
</client>
</system.serviceModel>
</configuration>服务器端(Web.Confing):
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true" />
<services>
<service name="ChartsService">
<endpoint address="" binding="customBinding" bindingConfiguration="ChartsService.customBinding0"
contract="ChartsService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="WeatherWebServiceSoap" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
<customBinding>
<binding name="WeatherWebServiceSoap12">
<textMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16"
messageVersion="Soap12" writeEncoding="utf-8">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</textMessageEncoding>
<httpTransport manualAddressing="false" maxBufferPoolSize="524288"
maxReceivedMessageSize="65536" allowCookies="false" authenticationScheme="Anonymous"
bypassProxyOnLocal="false" decompressionEnabled="true" hostNameComparisonMode="StrongWildcard"
keepAliveEnabled="true" maxBufferSize="65536" proxyAuthenticationScheme="Anonymous"
realm="" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false"
useDefaultWebProxy="true" />
</binding>
<binding name="ChartsService.customBinding0">
<binaryMessageEncoding />
<httpTransport />
</binding>
</customBinding>
</bindings>需不需要做什么修改和完善呢?
有精到广,做出自己的特色。
-
MSDN,有人么?????????
根目录下又放置了“crossdomain.xml”文件:
<?xml version="1.0" ?>
<cross-domain-policy>
<allow-access-from domain="*" />
<site-control permitted-cross-domain-policies="all" />
<allow-http-request-headers-from domain="*" headers="*" />
</cross-domain-policy>
但是还是报错,信息如下:
网页错误详细信息
用户代理: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; InfoPath.3; Zune 4.7; .NET CLR 1.1.4322)
时间戳: Sat, 24 Mar 2012 09:13:32 UTC
消息: Unhandled Error in Silverlight Application 操作过程中出现异常,结果无效。有关异常的详细信息,请查看 InnerException。 位于 System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary()
位于 MyCharts.MyChartsService.GetWaterMonitoringDatasCompletedEventArgs.get_Result()
位于 MyCharts.WaterMonitoring.client_GetWaterMonitoringDatasCompleted(Object sender, GetWaterMonitoringDatasCompletedEventArgs e)
位于 MyCharts.MyChartsService.ChartsServiceClient.OnGetWaterMonitoringDatasCompleted(Object state)
行: 1
字符: 1
代码: 0
URI: http://10.10.233.120/Tj/Web/WaterMonitoring.aspx有精到广,做出自己的特色。
-
string weburl = Application.Current.Host.Source.ToString();
weburl = weburl.Substring(0, (weburl.Length - 23)) + "/ChartsService.svc";
MyChartsService.ChartsServiceClient client = new MyChartsService.ChartsServiceClient("CustomBinding_ChartsService1", weburl);
这样写就好了。
但是还想再请教下。
1、跨域到底指的是什么?
2、“clientaccesspolicy.xml”和“crossdomain.xml”分别有什么作用?
3、
<endpoint address="http://localhost:2686/Mycems.UI/ChartsService.svc"
binding="customBinding" bindingConfiguration="CustomBinding_ChartsService"
contract="ChartsService.ChartsService" name="CustomBinding_ChartsService" />
<endpoint address="http://localhost:4707/Mycems.UI/ChartsService.svc"
binding="customBinding" bindingConfiguration="CustomBinding_ChartsService1"
contract="MyChartsService.ChartsService" name="CustomBinding_ChartsService1" />
为什么会有两个地址???有精到广,做出自己的特色。
-
1.cross domain通常是指web client与web service部署在不同的服务器上,或客户端程序与服务端程序采用了不同的端口号。
2.cross-domain policy文件准予web client(例如:Adobe Flash Player,silverlight)有权限跨域(如:第三方的远程服务)处理数据,通常我们只须要"clientaccesspolicy.xml"与"crossdomain.xml"文件中的一个,silverlight首先请求clientaccesspolicy.xml文件,如果没有找到该文件,就会检查crossdomain.xml文件是否存在,我们通常将crossdomain.xml or clientaccesspolicy.xml文件放在web server的根目录下面.你可以参考下面这篇英文文章: http://www.devtoolshed.com/explanation-cross-domain-and-client-access-policy-files-silverlight
3.你好像有两不同的服务契约吧,ChartsService.ChartsService与MyChartsService.ChartsService,默认为每个WCF服务地址分配一个随机的端口号。
Please mark the replies as answers if they help or unmark if not. If you have any feedback about my replies, please contact msdnmg@microsoft.com Microsoft One Code Framework
- 已编辑 Peter pi - MSFTModerator 2012年3月26日 4:02
- 已标记为答案 Peter pi - MSFTModerator 2012年3月30日 7:50
-
1.cross domain通常是指web client与web service部署在不同的服务器上,或客户端程序与服务端程序采用了不同的端口号。
2.cross-domain policy文件准予web client(例如:Adobe Flash Player,silverlight)有权限跨域(如:第三方的远程服务)处理数据,通常我们只须要"clientaccesspolicy.xml"与"crossdomain.xml"文件中的一个,silverlight首先请求clientaccesspolicy.xml文件,如果没有找到该文件,就会检查crossdomain.xml文件是否存在,我们通常将crossdomain.xml or clientaccesspolicy.xml文件放在web server的根目录下面.你可以参考下面这篇英文文章: http://www.devtoolshed.com/explanation-cross-domain-and-client-access-policy-files-silverlight
3.你好像有两不同的服务契约吧,ChartsService.ChartsService与MyChartsService.ChartsService,默认为每个WCF服务地址分配一个随机的端口号。
Please mark the replies as answers if they help or unmark if not. If you have any feedback about my replies, please contact msdnmg@microsoft.com Microsoft One Code Framework
有精到广,做出自己的特色。
-
1.cross domain通常是指web client与web service部署在不同的服务器上,或客户端程序与服务端程序采用了不同的端口号。
2.cross-domain policy文件准予web client(例如:Adobe Flash Player,silverlight)有权限跨域(如:第三方的远程服务)处理数据,通常我们只须要"clientaccesspolicy.xml"与"crossdomain.xml"文件中的一个,silverlight首先请求clientaccesspolicy.xml文件,如果没有找到该文件,就会检查crossdomain.xml文件是否存在,我们通常将crossdomain.xml or clientaccesspolicy.xml文件放在web server的根目录下面.你可以参考下面这篇英文文章: http://www.devtoolshed.com/explanation-cross-domain-and-client-access-policy-files-silverlight
3.你好像有两不同的服务契约吧,ChartsService.ChartsService与MyChartsService.ChartsService,默认为每个WCF服务地址分配一个随机的端口号。
Please mark the replies as answers if they help or unmark if not. If you have any feedback about my replies, please contact msdnmg@microsoft.com Microsoft One Code Framework
有精到广,做出自己的特色。
-
你上面客户端生成的app.config文件中,有两个服务契约,而且它们的命名空间不一样(ChartsService与MyChartsService),但是看下你的web.config文件,你的服务下面的endpoint中,契约没有添加命名空间,你最好是添加命名空间再试下:
<service name="ChartsService">
<endpoint address="" binding="customBinding" bindingConfiguration="ChartsService.customBinding0"
contract="YourNamespace.ChartsService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>关于2686端口,你可以参考下:http://ports.my-addr.com/tcp_port-udp_port-application-and-description.php?port=2826
Please mark the replies as answers if they help or unmark if not. If you have any feedback about my replies, please contact msdnmg@microsoft.com Microsoft One Code Framework