When I put my CSLA-based DataPortal up in Azure's Cloud Services, my WinForms application throws the following exception when it tries to access my business objects:
System.ServiceModel.Security.SecurityNegotiationException: Secure channel cannot be opened because security negotiation with the remote endpoint has failed. This may be due to absent or incorrectly specified EndpointIdentity in the EndpointAddress used to create the channel. Please verify the EndpointIdentity specified or implied by the EndpointAddress correctly identifies the remote endpoint.
(and this inner exception) System.ServiceModel.FaultException: The message with Action 'http://schemas.xmlsoap.org/ws/2005/02/trust/RST/Issue' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).
web.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="DalManagerType"
value="DataAccess.Mock.DalManager,DataAccess.Mock" />
<add key="CslaAuthentication" value="Csla" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime maxRequestLength="2147483647" targetFramework="4.5" />
<pages controlRenderingCompatibilityVersion="4.0" />
<membership defaultProvider="ClientAuthenticationMembershipProvider">
<providers>
<add name="ClientAuthenticationMembershipProvider"
type=
"System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider,
System.Web.Extensions, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35"
serviceUri="" />
</providers>
</membership>
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
<providers>
<add name="ClientRoleProvider"
type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions,
Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri=""
cacheTimeout="86400" />
</providers>
</roleManager>
</system.web>
<system.serviceModel>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<services>
<service name="Csla.Server.Hosts.WcfPortal"
behaviorConfiguration="returnFaults">
<endpoint binding="wsHttpBinding"
bindingConfiguration="wsHttpBinding_IWcfPortal"
contract="Csla.Server.Hosts.IWcfPortal" />
<endpoint contract="IMetadataExchange" binding="mexHttpBinding"
address="mex" />
</service>
</services>
<bindings>
<wsHttpBinding>
<binding name="wsHttpBinding_IWcfPortal"
maxReceivedMessageSize="2147483647">
<security mode="None">
<message establishSecurityContext="false" />
<transport clientCredentialType="None" />
</security>
<readerQuotas maxBytesPerRead="2147483647"
maxArrayLength="2147483647"
maxStringContentLength="2147483647"
maxNameTableCharCount="2147483647"
maxDepth="2147483647" />
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="returnFaults">
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceMetadata httpGetEnabled="true" />
<useRequestHeadersForMetadataAddress />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<directoryBrowse enabled="true" />
</system.webServer>
</configuration>
app.config for my WinForms app:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="CslaPropertyChangedMode" value="Windows" />
<add key="CslaDataPortalProxy"
value="Csla.DataPortalClient.WcfProxy, Csla" />
<add key="CslaDataPortalUrl" value="http://127.0.0.2:81/WcfPortal.svc" />
</appSettings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IWcfPortal"
maxReceivedMessageSize="2147483647">
<security mode="None" />
<readerQuotas
maxBytesPerRead="2147483647"
maxArrayLength="2147483647"
maxStringContentLength="2147483647"
maxNameTableCharCount="2147483647"
maxDepth="2147483647"/>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint
address="http://127.0.0.2:81/WcfPortal.svc"
binding="wsHttpBinding"
bindingConfiguration="WSHttpBinding_IWcfPortal"
contract="Csla.Server.Hosts.IWcfPortal"
name="WSHttpBinding_IWcfPortal"/>
</client>
</system.serviceModel>
</configuration>
When I browse to the WcfPortal.svc files locally or in Azure, I do not get any errors. When I browse to WcfPortal.svc?wsdl locally or in Azure, I get the proper XML response; no errors.
I have uploaded this entire solution to GitHub: AzureHostTest. There are two branches: the master
branch just contains the projects that I'm trying to get to work in Azure. The other branch, traditionalWCF
, contains three additional projects that demonstrate a standard WCF service working in Azure; I was hoping to use that working set of files as comparison and guidance to setup the CSLA projects.
I'm unsure how I should be setting up my config files and could use some guidance.