Hi everybody,
for quite some days I am chewing on how to call a wcf service for a Silverlight app via apache reverse proxy correctly. The setting is as follows:
Apache reverse proxy called via https:
https://DmzServerURL/SL_App_01 is routed to
http://192.168.2.5/Sl_App_01/
Everything is working fine (Silverlight app shows up) up to the moment I need data from the SQL server. Depending on how I configure the endpoint I get either no errors and nothing is happening up to "No server found" etc.
I can call the svc by:
https://DmzServerURL/SL_App_01/WcfPortal.svc
and can see the correct svc URL using my internal server in the svcutil.exe call. I think I am missing some settings in web.config to use the internal svc adress.
After 3 days of reading the fog becomes thicker instead of getting a clue what to do.
Here are my Application_Startup and web.config:
The actual setting is in index.html - so I can change the endpoind without recompiling.
private void Application_Startup(object sender, StartupEventArgs e) { string cDataPortalUrlString = ""; string cBasicHttpSecurityMode = "none"; if (e.InitParams.ContainsKey("prodUrl")) { cDataPortalUrlString = e.InitParams["prodUrl"]; } if (e.InitParams.ContainsKey("BasicHttpSecurityMode")) { cBasicHttpSecurityMode = e.InitParams["BasicHttpSecurityMode"]; } Csla.ApplicationContext.DataPortalProxy = typeof(Csla.DataPortalClient.WcfProxy).AssemblyQualifiedName; Csla.ApplicationContext.DataPortalUrlString = cDataPortalUrlString; var binding = new BasicHttpBinding(); binding.MaxBufferSize = int.MaxValue;
// some more binding properties
if (cBasicHttpSecurityMode.ToLower() == "none") { binding.Security.Mode = BasicHttpSecurityMode.None ; } else { binding.Security.Mode = BasicHttpSecurityMode.Transport; } Csla.DataPortalClient.WcfProxy.DefaultBinding = binding; this.RootVisual = new MainPage(); }
the crucial line in index.html is:
<param name="initParams" value="prodUrl=https://DmzServerURL/Sl_App_01/WcfPortal.svc, BasicHttpSecurityMode=None" />
And this is my web.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<connectionStrings>
<add
name="SqlConnStr"
connectionString="Data Source=localhost;Initial Catalog=DB_Name;Integrated Security= false;User ID=UserID;Password=*****"
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.serviceModel>
<!--serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" /-->
<behaviors>
<serviceBehaviors>
<behavior name="WcfPortalBehavior">
<!--for http and https -->
<serviceMetadata httpsGetEnabled="true" httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
<behavior name="">
<!--for http and https -->
<serviceMetadata httpsGetEnabled="true" httpGetEnabled="true"
externalMetadataLocation="http://192.168.2.5/Sl_App_01/WcfPortal.svc" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="WcfPortalBehavior" name="Csla.Server.Hosts.Mobile.WcfPortal">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="basicHttpBinding_IWcfPortal" contract="Csla.Server.Hosts.Mobile.IWcfPortal">
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="basicHttpBinding_IWcfPortal" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<!--for http -->
<security mode="None">
<!--for https -->
<!--security mode="Transport"-->
</security>
</binding>
</basicHttpBinding>
</bindings>
</system.serviceModel>
<system.web>
<compilation targetFramework="4.5" />
<authentication mode="Windows" />
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID" />
</system.web>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Csla" publicKeyToken="93be5fdc093e4c30" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.5.601.0" newVersion="4.5.601.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
Needless to say that the app works perfectly in an local environment or without the reverse proxy on a web server.
Sorry for the long post - maybe somebody can help or at least push me in the right direction.
regards
TIA
Uwe
Copyright (c) Marimer LLC