2009-07-31 154 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