views:

1440

answers:

2

I've made a copy of my production website for staging purposes. My Silverlight app is served on port 81, and tries to access a WCF service via SSL on port 2443. I've verified that the service is reachable by typing in the URL:

https://mydomain.com:2443/UtilService.svc -- I get the "you have created a service" page.

But when my SL app tries to execute an operation on the service, I get the famous "NotFound" exception in the End portion of my webservice client code:

   {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)}

I've modified clientaccesspolicy.xml as follows:

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

Other things of note:

  • The production site serves an identical service on 443 without any issues

  • Using fiddler, I've verified that a CONNECT:2443 shows up at the right time.

  • I turned off the SSL requirement in IIS and modified the WCF configuration to remove Transport security, and modified the SL app to access the service on port 81 -- and it works.

  • I'm running IIS 6.

Is there some ju-ju I need to be able to access the service via port 2443?

A: 

It might be that you need to run httpcfg to get IIS to listen for SSL traffic on port 2443.

http://msdn.microsoft.com/en-us/library/ms733768.aspx

http://technet.microsoft.com/en-us/library/cc781601(WS.10).aspx

Shiraz Bhaiji
+4  A: 

Sigh. It had nothing to do with Silverlight: the problem was too-strict address filtering on the service endpoint. I added the following to my service class, and it all works:

[ServiceBehavior(AddressFilterMode = AddressFilterMode.Any)]

I discovered this by creating a Windows client to the service, which returned much more information about the error. The moral of the story is: don't rely on Silverlight to give you the whole picture!

Ben M
Wow. Been having this problem for a while and just decided to never use non-standard ports. This just solved a huge issue for me!
TheCodeMonk