Local DataPortal works, but Remote DataPortal does not

Local DataPortal works, but Remote DataPortal does not

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

Brad Rem posted on Wednesday, July 03, 2013

On my local development machine, I have a WinForms app that connects to the WCF based DataPortal and everything works fine.

When I publish the DataPortal to the server and change my connection in my WinForm app to use the remote data portal, it throws the following exceptions:

"The caller was not authenicated by the service."

"The request for the security token could not be satisifed because authenication failed."

When I browse to http:://www.mycompany.com/DataPortal.svc, I get the proper information and can display the WSDL information, too.

My web.config has this in it:

            <service name="Csla.Server.Hosts.WcfPortal" behaviorConfiguration="returnFaults">
                <binding name="wsHttpBinding_IWcfPortal" maxReceivedMessageSize="2147483647">
                <behavior name="returnFaults">
                    <serviceDebug includeExceptionDetailInFaults="true"/>
                    <serviceMetadata httpGetEnabled="true"/>

 And my app.config contains the usual CSLA settings:

<add key="CslaPropertyChangedMode" value="Windows"/>
<add key="CslaDataPortalProxy" value="Csla.DataPortalClient.WcfProxy, Csla"/>
<add key="CslaDataPortalUrl" value="http://www.mycompany.com/DataPortal.svc"/>
<add key="CslaAuthentication" value="Csla"/>

 Any guidance for how I can use my data portal once it's published to the server?



JonnyBee replied on Wednesday, July 03, 2013

From the exception message there is a mismatch in authentication. 

Is your server configured to use Windows Authentication

If so try to activate Anonymous Authentication on your server and check if the portal works as expected. 

If you want to use WIndows Authentication you must also configure WCF to use that authentication type on both server and client. 

Brad Rem replied on Wednesday, July 03, 2013

I have just confirmed in IIS that the Authentication is has Anonymous Authentication enabled and all other forms are disabled.





JonnyBee replied on Wednesday, July 03, 2013

Do you have 

<add key="CslaAuthentication" value="Csla"/> 

in your web.config? 

Brad Rem replied on Wednesday, July 03, 2013


Do you have 

<add key="CslaAuthentication" value="Csla"/> 

in your web.config? 

Yes, I have that in there.  It is in my web.config and also my app.config.

JonnyBee replied on Thursday, July 04, 2013

Well, then it's likely hardcore transport debugging to be done.

You should use FIDDLER or a network trace tool to inspect the communication and try to detect why/where there is mismatch in the authentication. 

Brad Rem replied on Monday, July 08, 2013

I should say at this point that I'm trying to host in Azure.

This is what I've done (among a million other things, but these are the most salient):

I've created a plain WCF service and confirmed that I can host it in Azure.

Rocky has an AzureHost example project that is associated with the DataPortal book. It runs a Silverlight application and I've confirmed that it runs in Azure.

Then, I added a Windows Form project to the AzureHost project and set the CslaDataPortalUrl element in the WinForm App.Config to the local AzureHost instance and it actually runs.

But, once I publish the data portal to Azure, change my CslaDataPortalUrl to the Azure address for the .svc file, I get the exception "The request for security token could not be satisfied because authentication failed."

Azure defaults to anonymous authentication so I'm not sure what else I need to be looking at. Is Azure really that different that IIS, even though they love to say it is not?

Brad Rem replied on Monday, July 15, 2013

After trying ever machination I could find with getting an Azure WCF-based CSLA data portal to work with a WinForms application, I'm finally to the point where I don't think it's possible.  I'm able to get a standard WCF service to work in Azure, but getting CSLA to work has been fruitless no matter how many settings I fiddle with in the config files.

The CSLA examples are for Silverlight programs and they work in Azure, and I've even tried to take the AzureHost project and modify it to have a WinForms app access the library, but that has failed. In fact, I've created a test GitHub project to make it easy for somebody to point out how to hook up WinForms to Azure:


I also have a StackOverflow question with a nice bounty running and nobody has submitted a solution:


I'm beyond baffled.



RockfordLhotka replied on Monday, July 15, 2013

When you say "in Azure" do you mean in a web site or a cloud service?

I have numerous data portal end points running in cloud services (web role). I don't know that I've tried hosting one in an azure web site, so there could be unforeseen issues there I suppose.

Brad Rem replied on Monday, July 15, 2013

Azure, cloud services with a web role.  You have a project called AzureHost that goes along with the DataPortal book. I essentially took that project, removed the Silverlight stuff and tried to make it work with WinForms app because I wasn't able to get my actual project working.  I've tried certifcates and different wsHttpSettings and practically everything under the sun, but keeping running into one exception after another.

I direct you to my StackOverflow question for my complete write up:


And my bare-bones test project on GitHub to illustrate my struggles:


I'm feeling at the end of my rope.



Copyright (c) Marimer LLC