代码之家  ›  专栏  ›  技术社区  ›  Ben M

Silverlight:在非标准SSL端口上访问SSL WCF服务

  •  2
  • Ben M  · 技术社区  · 15 年前

    我已经制作了一份制作网站的副本,以备登台之用。我的Silverlight应用程序在端口81上提供服务,并尝试通过端口2443上的SSL访问WCF服务。我已通过键入URL验证该服务是否可访问:

    https://mydomain.com:2443/UtilService.svc

    但是,当我的SL应用程序尝试在服务上执行操作时,我在webservice客户端代码的结尾部分出现了著名的“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)}
    

    <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>
    

    其他值得注意的事项:

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

    我需要通过端口2443访问服务吗?

    2 回复  |  直到 15 年前
        1
  •  4
  •   Ben M    15 年前

    叹气这与Silverlight无关:问题在于服务端点上的地址过滤过于严格。我在我的服务类中添加了以下内容,并且一切正常:

    [ServiceBehavior(AddressFilterMode = AddressFilterMode.Any)]
    

        2
  •  0
  •   Shiraz Bhaiji    15 年前