Silverlight调用WebService,发布IIS,本机可以访问,其他机器不能访问。十万火急!求帮助!谢谢!

zzg1008 2014-12-16 03:19:49
VS2010 + IIS7 + Silverlight 5.1.20513.0,刚接手一个前人交接的项目。里面有Sliverlight调用Webservice,在首页显示内容的一个功能。一直以来都是没有问题的,其中ServiceReferences.ClientConfig文件内容如下:
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="SilverLightServiceSoap" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647">
<security mode="None" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost/SilverLightService.asmx"
binding="basicHttpBinding" bindingConfiguration="SilverLightServiceSoap"
contract="OnePageService.SilverLightServiceSoap" name="SilverLightServiceSoap" />
</client>
</system.serviceModel>
</configuration>
不存在跨域问题,因为是公司内部的网,没有clientaccesspolicy.xml和crossdomain.xml,发布在IIS上的是https,默认端口443,一切都能正常运行。就在上礼拜突然首页就报错了,错误如下(135.251.45.147是程序发布的服务器):网页错误详细信息

用户代理: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/5.0; SLCC2; .NET CLR 2.0.50727; Media Center PC 6.0; .NET4.0E; MS-RTC LM 8; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C)
时间戳: Tue, 16 Dec 2014 06:08:24 UTC


消息: Unhandled Error in Silverlight Application [Async_ExceptionOccurred]
参数:
调试资源字符串不可用。密钥和参数通常提供足够的信息用以诊断该问题。请访问 http://go.microsoft.com/fwlink/?linkid=106663&Version=5.1.30514.00&File=System.dll&Key=Async_ExceptionOccurred 位于 System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary()
位于 MapsHotspotDemo.OnePageService.GetUserViewRangeCompletedEventArgs.get_Result()
位于 MapsHotspotDemo.MainPage.slClient_GetUserViewRangeCompleted(Object sender, GetUserViewRangeCompletedEventArgs e)
位于 MapsHotspotDemo.OnePageService.SilverLightServiceSoapClient.OnGetUserViewRangeCompleted(Object state)
行: 1
字符: 1
代码: 0
URI: https://135.251.45.147/DefaultBoss.aspx


消息: Unhandled Error in Silverlight Application [Async_ExceptionOccurred]
参数:
调试资源字符串不可用。密钥和参数通常提供足够的信息用以诊断该问题。请访问 http://go.microsoft.com/fwlink/?linkid=106663&Version=5.1.30514.00&File=System.dll&Key=Async_ExceptionOccurred 位于 System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary()
位于 MapsHotspotDemo.OnePageService.InitOnePageSummaryCompletedEventArgs.get_Result()
位于 MapsHotspotDemo.MainPage.slClient_InitOnePageSummaryCompleted(Object sender, InitOnePageSummaryCompletedEventArgs e)
位于 MapsHotspotDemo.OnePageService.SilverLightServiceSoapClient.OnInitOnePageSummaryCompleted(Object state)
行: 1
字符: 1
代码: 0
URI: https://135.251.45.147/DefaultBoss.aspx

于是乎,开始查问题,上网看了很多朋友说的那些原因及解决方法,都不可行。唯一一种把ServiceReferences.ClientConfig文件改成以下内容,网页可以正常访问,但这是http,不是https:
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="SilverLightServiceSoap" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647">
<security mode="None" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://135.251.45.147/SilverLightService.asmx"
binding="basicHttpBinding" bindingConfiguration="SilverLightServiceSoap"
contract="OnePageService.SilverLightServiceSoap" name="SilverLightServiceSoap" />
</client>
</system.serviceModel>
</configuration>
于是我又试了改成下面的:
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="SilverLightServiceSoap" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647">
<security mode="Transport" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="https://135.251.45.147/SilverLightService.asmx"
binding="basicHttpBinding" bindingConfiguration="SilverLightServiceSoap"
contract="OnePageService.SilverLightServiceSoap" name="SilverLightServiceSoap" />
</client>
</system.serviceModel>
</configuration>
这样一来,服务器本机可以正常访问,但是其他机器去访问就还是报上面的错误。这个问题已经研究好久了,都没有解决。特此求助论坛里的各位经验丰富的大神了,谢谢了!
...全文
370 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
zzg1008 2014-12-16
  • 打赏
  • 举报
回复
引用 1 楼 kongwei521 的回复:
address="http://135.251.45.147:443/SilverLightService.asmx" 加上端口访问测试下。
你可能看错了,这里的443是https的默认端口,相当于80是http的默认端口一样
蝶恋花雨 2014-12-16
  • 打赏
  • 举报
回复
1、重新发布wcf
  2、更新sl对wcf的引用
  3、重新编译sl项目
  4、检查sl项目中的ServiceReferences.ClientConfig配置文件中的wcf地址
  5、用地址是否可以访问wcf
6、在IE的把http://135.251.45.147添加信任站点
参考 http://www.tuicool.com/articles/7rUriez
蝶恋花雨 2014-12-16
  • 打赏
  • 举报
回复
address="http://135.251.45.147:443/SilverLightService.asmx" 加上端口访问测试下。

12,162

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 Web Services
社区管理员
  • Web Services社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧