0

I'm running SL4 on VS2010. I've got an app that authenticates via a web service to SPROC in my db. Unfortunately this is not WCF/WCF RIA, as I'm inheriting the DB/services from my client.

This works perfectly inside of a browser (via HTTPS). I'm attempting to move this OOB, and it's at this point that my authentication fails. Here's the steps I took...

1) SL App Properties > Enable running app Out of Browser 2) SL App Properties > Out of Browser Settings > Require elevated trust when running OOB

If i set a breakpoint on my logon button click, I see the service call is being made. However, if I step through it (or set a breakpoint on the actual logon web service), the code never gets that far. Here's the block it fails on:

public LogonSVC.LogonResponse EndLogon(System.IAsyncResult result) {
            object[] _args = new object[0];
            LogonSVC.LogonResponse _result = ((LogonSVC.LogonResponse)(base.EndInvoke("Logon", _args, result)));
            return _result;
        }

I know using Elevated Trust means the crossdomain.xml isn't necessary. I dropped one in that allows everything, just to test, and that still fails.

here's the code that calls the service:

private void loginButton_Click(object sender, RoutedEventArgs e)
    {
        string Username = txtUserName.Text;
        string Password = txtPassword.Password;
        Uri iSilverlightServiceUriRelative = new Uri(App.Current.Host.Source, "../Services/Logon.asmx");
        EndpointAddress iSilverlightServiceEndpoint = new EndpointAddress(iSilverlightServiceUriRelative);
        BasicHttpBinding iSilverlightServiceBinding = new BasicHttpBinding(BasicHttpSecurityMode.Transport);// Transport if it's HTTPS://
        LogonService = new LogonSVC.LogonSoapClient(iSilverlightServiceBinding, iSilverlightServiceEndpoint);
        LogonService.LogonCompleted += new EventHandler<LogonSVC.LogonCompletedEventArgs>(LogonService_LogonCompleted);
        LogonService.LogonAsync(Username, Password);
    }

My LogonService_LogonCompleted doesn't fire either (which makes sense, just a heads up).

I don't know how to fiddler this, as this is running OOB with the site served via localhost/IIS. I know this works though in browser, so I'm curious what would break it OOB.

UPDATE I changed my ServiceReferences.ClientConfig to relative URLs instead of absolute, at the recommendation of another post I read. Here's the code:

<configuration>
<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="CommonSoap" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
                <security mode="Transport" />
            </binding>
            <binding name="LogonSoap" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
                <security mode="Transport" />
            </binding>
        </basicHttpBinding>
    </bindings>
    <client>
        <endpoint address="/Services/Common.asmx"
            binding="basicHttpBinding" bindingConfiguration="CommonSoap"
            contract="CommonSVC.CommonSoap" name="CommonSoap" />
        <endpoint address="/Services/Logon.asmx"
            binding="basicHttpBinding" bindingConfiguration="LogonSoap"
            contract="LogonSVC.LogonSoap" name="LogonSoap" />
    </client>
</system.serviceModel>

UPDATE 2

Stack trace, if it helps anyone...

   at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult 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 TSMVVM.TSMVVMLogonSVC.LogonSoapClient.LogonSoapClientChannel.EndLogon(IAsyncResult result)
   at TSMVVM.TSMVVMLogonSVC.LogonSoapClient.TSMVVM.TSMVVMLogonSVC.LogonSoap.EndLogon(IAsyncResult result)
   at TSMVVM.TSMVVMLogonSVC.LogonSoapClient.EndLogon(IAsyncResult result)
   at TSMVVM.TSMVVMLogonSVC.LogonSoapClient.OnEndLogon(IAsyncResult result)
   at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result)

Thank you,

Scott

Scott Silvi
  • 3,059
  • 5
  • 40
  • 63
  • This error indicates problems on server. Implement diagnostics as here: http://stackoverflow.com/questions/4773026/how-to-debug-wcf-service-call-works-in-vs-but-not-in-iis/4783388#4783388 and add information about a real type of the error. – vortexwolf Feb 15 '11 at 09:30
  • Hey Vorrtex. That appears to be for WCF. I tried implementing it (just add system.diagnostics to my web.config, yes?). No log file. I'm not using WCF, I'm using asmx web services. – Scott Silvi Feb 15 '11 at 17:27

1 Answers1

0

I'm not allowed to comment so I'll have to post this question as an answer

Is it because Silverlight treats all http error codes other than 200 as a 404.

Use fiddler to check the response status code and try an http handler to change it to a 200. This was a common problem in silverlight 2 which I thought they'd fixed but maybe the fix was only for WCF and RIA services.

BenCr
  • 5,991
  • 5
  • 44
  • 68
  • As I said in my post, I'm not sure how to use fiddler for this. The solution has a website (not web app) that's set to https://localhost/ts/testSLpage.aspx, which has my SL app residing inside. Beyond that, once I move to OOB, I'm not sure how that impacts Fiddler either. – Scott Silvi Feb 16 '11 at 17:48
  • Also, with Fiddler... I've tried adding the proxy solution to my web.config, I've changed my endpoint addresses to https://mymachine/projectName/pageName, https://ipv4.fiddler/projectName/pageName... I've navigated directly in browser to https://mymachine/projectName/pageName, and I've run it in FF too (which doesn't have the same issues).... is the fact that this is HTTPS an issue? – Scott Silvi Feb 16 '11 at 19:00
  • Ok, if you're using OOB then maybe fiddler isn't a good solution. Try Wireshark, it's a more complicated tool but captures all the traffic at the network card rather than just the browser. You'll have to configure filters to remove everything apart from your application traffic. – BenCr Feb 17 '11 at 09:51