E-books Sample: Help me get it working!!

E-books Sample: Help me get it working!!

Old forum URL: forums.lhotka.net/forums/t/10748.aspx


jh72i posted on Friday, October 07, 2011

Every day a new problem making every day damn frustrating at the moment and the chance of making deadlines more and more unlikely.

Today i have hit the "Remote Server returned and error NotFound" exception when trying to get credential sharing between a SL client and a backend. I have downloaded and run Rocky's sample: 04-DataPortal-110504\Authentication\Windows\Windows.sln and simply cannot figure out how to get it to run properly.

I can get it to run if i remove the following section from the config file:
<security mode="TransportCredentialOnly">
<
transport clientCredentialType="Windows" /></security>

I'm dealing with a lot of new technologies and approaches at the moment so please appreciate i am no expert in any of this. I need to get a bunch of things working first and come back and figure them all out later!

What do i have to do to get this sample to just work.

Thank you

jh72i replied on Friday, October 07, 2011

The error: {: The remote server returned an error: NotFound. 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 Csla.WcfPortal.WcfPortalClient.WcfPortalClientChannel.EndFetch(IAsyncResult result) at Csla.WcfPortal.WcfPortalClient.Csla.WcfPortal.IWcfPortal.EndFetch(IAsyncResult result) at Csla.WcfPortal.WcfPortalClient.OnEndFetch(IAsyncResult result) at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result) : The remote server returned an error: NotFound. 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) : The remote server returned an error: NotFound. at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult) at System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClass5.b__4(Object sendState) at System.Net.Browser.AsyncHelper.<>c__DisplayClass2.b__0(Object sendState) } [Csla.DataPortalException]: {: The remote server returned an error: NotFound. 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 Csla.WcfPortal.WcfPortalClient.WcfPortalClientChannel.EndFetch(IAsyncResult result) at Csla.WcfPortal.WcfPortalClient.Csla.WcfPortal.IWcfPortal.EndFetch(IAsyncResult result) at Csla.WcfPortal.WcfPortalClient.OnEndFetch(IAsyncResult result) at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result) : The remote server returned an error: NotFound. 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) : The remote server returned an error: NotFound. at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult) at System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClass5.b__4(Object sendState) at System.Net.Browser.AsyncHelper.<>c__DisplayClass2.b__0(Object sendState) } Data: {System.Collections.ListDictionaryInternal} InnerException: null Message: "The remote server returned an error: NotFound." StackTrace: null

RockfordLhotka replied on Monday, October 10, 2011

The "NotFound" exception is (sadly) useless. It just means that WCF couldn't wire up the client's call to a service. It usually does mean your call isn't getting to any of your server-side code, and often indicates a server-side configuration or assembly reference issue. Sometimes you can use fiddler or WCF tracing to get more information.

To put it bluntly: WCF security is a b*tch.

The number of moving parts and configuration options/issues are vast.

You can start by putting an aspx page into your web site, and on that page display the information from the current principal. That can often help diagnose errors with the server-side security configuration. Basically, before you can do anything on the client, you have to get IIS and ASP.NET configured to require Windows authentication and to do impersonation. This is easier to debug in aspx than in an svc.

jh72i replied on Wednesday, October 12, 2011

Thanks for the replies folks. Been in hospital since the weekend with my brand new baby boy so not advanced any on this problem & funnily enough it has somehow lost it's importance in my priority list :-) it will of course move back up when the need to get paid kicks in. Rocky can you get working on Csla90 for my boy should he be crazy enough to choose software as a career. If such a thing exists in 2030 :-)

RockfordLhotka replied on Wednesday, October 12, 2011

jh72i
Rocky can you get working on Csla90 for my boy should he be crazy enough to choose software as a career. If such a thing exists in 2030 :-)

I'll get right on that :)

Congratulations on the new baby, that's great news!

jh72i replied on Monday, October 17, 2011

Thanks for the congrats Rocky - I'm pretty sure I have read that you are a dad too so you'll understand my emotional state at present.

And thanks to both fo you for the steers about the notfound exception. I probably wasn't thinking straight before but my head is clear now and within 5 minutes of sitting at my desk i managed to sort out the problem. Well, for now at least.
I looked at the IISExpress applicationhost.config file and enabled the WindowsAuthentication flag. That gets rid of the NotFound exception and I can see my security info travel to my dataportal_xyz methods. I have a suspicion that this probably isn't the ultimate solution but it allows me to get through this roadblock for now so, again, thank you both.

 <security>
 <authentication>
  <windowsAuthentication enabled="true">
   <providers>
    <add value="Negotiate" />
    <add value="NTLM" />
   </providers>
  </windowsAuthentication>
 </authentication>

 

TSF replied on Monday, October 10, 2011

I've recently had to get an SL4 app working with Windows/AD security and it did take a lot of work to figure out the right combination of settings on IIS and within the config file.  In my case, I found it helpful first of all to browse to the service address and see if my browser could reach it.  If I wasn't able to do that, I wouldn't bother with the app.  That may or may not be the right way to do it, but that is how I approached it.

Copyright (c) Marimer LLC