2009-07-31 99 views
2

我制作了用于分段目的的生产网站的副本。 My Silverlight应用程序在端口81上提供,并尝试通过端口2443上的SSL访问WCF服务。我已通过在URL中输入内容来验证该服务是否可用:Silverlight:在非标准SSL端口上访问SSL WCF服务

https://mydomain.com:2443/UtilService.svc - 我得到“您有创建了一个服务“页面。

但是当我SL应用程序尝试对服务执行操作,我得到了我的Web服务客户端代码的端部著名的“NOTFOUND”例外:

{System.ServiceModel.CommunicationException: The remote server returned an error: NotFound. ---> System.Net.WebException: The remote server returned an error: NotFound. ---> System.Net.WebException: The remote server returned an error: NotFound. 
    at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult) 
    at System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClass5.<EndGetResponse>b__4(Object sendState) 
    at System.Net.Browser.AsyncHelper.<>c__DisplayClass2.<BeginOnUI>b__0(Object sendState) 
    --- End of inner exception stack trace --- 
    at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state) 
    at System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult) 
    at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result) 
    --- End of inner exception stack trace --- 
    at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result) 
    at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result) 
    at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result) 
    at System.ServiceModel.ClientBase`1.ChannelBase`1.EndInvoke(String methodName, Object[] args, IAsyncResult result) 
    at UtilServiceClient.UtilServiceClientChannel.EndTryAutoLogon(IAsyncResult result) 
    at UtilServiceClient.UtilServiceReference.IUtilService.EndTryAutoLogon(IAsyncResult result) 
    at UtilServiceClient.OnEndTryAutoLogon(IAsyncResult result) 
    at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result)} 

我修改clientaccesspolicy.xml如下:

<access-policy> 
    <cross-domain-access> 
    <policy> 
     <allow-from http-request-headers="*"> 
     <domain uri="http://*.mydomain.com:81"/> 
     <domain uri="https://*.mydomain.com:2443"/> 
     </allow-from> 
     <grant-to> 
     <resource path="/" include-subpaths="true"/> 
     </grant-to> 
    </policy> 
    </cross-domain-access> 
</access-policy> 

注意其他的事情:

  • 生产现场在443上提供相同的服务而没有任何问题

  • 使用fiddler,我已验证CONNECT:2443在正确的时间出现。

  • 我关闭了IIS中的SSL要求,并修改了WCF配置以删除传输安全性,并修改了SL应用程序以访问端口81上的服务 - 并且工作正常。

  • 我运行IIS 6

有一些菊菊我需要能够通过端口2443来访问服务?

回答

4

叹息。它与Silverlight无关:问题是服务端点上的地址过滤过于严格。我增加了以下我的服务类,而这一切的工作原理:

[ServiceBehavior(AddressFilterMode = AddressFilterMode.Any)] 

我通过创建一个Windows客户端的服务,它返回有关错误的更多信息,发现这一点。故事的寓意是:不要依赖Silverlight给你全部的照片!

+0

哇。一直有这个问题,只是决定不使用非标准的端口。这为我解决了一个大问题! – TheCodeMonk 2010-05-07 20:34:00