asp.net站点中使用了“Silverlight”的“Xap页面”。现状:
站点中添加了“启用了Silverlight的WCF服务”,用来为“Silverlight”提供数据访问。发布之后,部署在IIS6.0下,“Xap页面”中的内容就显示不出来了,已经添加了“MIME”。而在VS2010开发环境中是正常的呢?问题:请问这是为什么呢?是不是“启用了Silverlight的WCF服务”需要在“IIS6下”进行什么配置?
站点中添加了“启用了Silverlight的WCF服务”,用来为“Silverlight”提供数据访问。发布之后,部署在IIS6.0下,“Xap页面”中的内容就显示不出来了,已经添加了“MIME”。而在VS2010开发环境中是正常的呢?问题:请问这是为什么呢?是不是“启用了Silverlight的WCF服务”需要在“IIS6下”进行什么配置?
还有你的网站下放置了跨域访问文件了嘛?
“MIME类型”这个没有问题。
什么是“跨域访问文件”,好像没有?必须要放么?访问WCF如下图:
“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>
参考
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="*">
<domain uri="*"/>
<domain uri="http://*"/>
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
MIME类型:application/xaml+xml
文件加上了啊,但是提示错误信息如下:网页错误详细信息用户代理: 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
Client客户端:<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>
<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>谢谢你,万分感激。
<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
使用调试工具去看http通讯过程。它是非常精简的,要比你去看高层次的那些网页啊、文档啊,来的简单。只要看一下你启动网页之后的几个浏览器请求消息,你就知道它访问哪里去了,就知道是哪里造成的了。所以,使用调试工具。会不会不在于编程本身,而在于你是否将测试进行得比较充分了。
嗯。谢谢您。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);这样写就好了。但是还想再请教下,跨域到底指的是什么?
“clientaccesspolicy.xml”和“crossdomain.xml”分别有什么作用?