CSLA Silverlight 4 app works in VS2010 but not when deployed to IIS

CSLA Silverlight 4 app works in VS2010 but not when deployed to IIS

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


Russ posted on Monday, June 14, 2010

I just opened a Silverlight 3 CSLA application in VS2010 and converted it to CSLA 4 and Silverlight 4. The conversion process regenerated the web.config file with a default blank one. I have pasted Rocky's code directly from his Collective sample for the WcfSlPortal.svc, Web.config and ServiceReferences.ClientConfig files. The WcfSlPortal.svc file is unchanged. The Web.config file connection string section changed and I commented out the compilation assemblies section and the authentication mode="Windows". The only change to the ServiceReferences.ClientConfig file is the port on the endpoint address. The conversion also removed the "Csla.DataPortal.ProxyTypeName = typeof(Business.Compression.CompressedProxy<>).AssemblyQualifiedName;" From the App.Xaml.cs file so I re-added it.

After fixing all the references and changing the syntax, such as Business Rules, it compiles and works perfectly on my development system. The problem is that it refuses to work when deployed to my IIS6 or IIS7 servers. I already have other Silverlight 4 apps running on both IIS servers so I know that I have properly installed .Net framework 4.

When I point my browser at the website it downloads the xap file and runs it correctly. It prompts me for login credentials and when I enter them and press Login Fiddler2 show a request being sent to the WcfSlPortal.svc. A SQL Server trace shows that the login request never makes it to the SQL database.

Nothing appears in the IIS machine event logs to help me diagnose this.

Fiddler2 shows a FetchResult containing the following error data:

<a:ErrorData i:nil="true" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:a="http://schemas.datacontract.org/2004/07/Csla.Server.Hosts.Silverlight" />

Not much to go on.

Does anyone have any suggestions?

tgddev replied on Tuesday, June 15, 2010

Have you checked the address location for the SOAP operations of you WCF service? (http://...../WcfSlPortal.svc?wsdl)

Russ replied on Tuesday, June 15, 2010

Thanks tgddev, while trying to write my response to your post I was able to make some progress on the problem.

I tried a number of different addresses. The endpoint from Rocky's Collective sample is:

<endpoint address="" binding="basicHttpBinding" contract="Csla.Server.Hosts.Silverlight.IWcfPortal" bindingConfiguration="BasicHttpBinding_IWcfPortal">

When I try using this endpoint Fiddler2 reports a result 200 with the correct host IP and a body of 1702 bytes which contains the error message in my first post. When I change the endpoint address I get the following results:

1) http://localhost/App_folder/WcfSlPortal.svc returns result HTTP/1.1 200 OK. This behaves the same as address="".

2) http://localhost/App_folder/WcfSlPortal.svc?wsdl returns result HTTP/1.1 500 System.ServiceModel.ServiceActivationException.

3) http://1.2.3.4/App_folder/WcfSlPortal.svc where 1.2.3.4 = IP Address of IIS server returns result HTTP/1.1 200 OK. This behaves the same as address="".

4) http://1.2.3.4/App_folder/WcfSlPortal.svc?wsdl where 1.2.3.4 = IP Address of IIS server returns result HTTP/1.1 500 System.ServiceModel.ServiceActivationException

If I type http://localhost.App_Folder/WcfSlPortal.svc into IE on the IIS server I get the following:

Server Error in '/App_folder' Application.

--------------------------------------------------------------------------------

 

A base address cannot contain a Uri query string.

Parameter name: baseAddress

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

 

Exception Details: System.ArgumentException: A base address cannot contain a Uri query string.

Parameter name: baseAddress

 

Source Error:

 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 

 

Stack Trace:

 

[ArgumentException: A base address cannot contain a Uri query string.

Parameter name: baseAddress]

...

--------------------------------------------------------------------------------

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1

 

This is a strange error given the URL that was entered. Turns out that the underscore character was the cause! I changed the location from App_folder to Appfolder and it works! I now get the proper Compressed Host Service page.

Running through the testing again I get:

0) address="" returns result HTTP/1.1 200 OK, the correct host IP and a body of 1702 bytes which contains the error message in my first post

1) http://localhost/Appfolder/WcfSlPortal.svc returns result HTTP/1.1 200 OK. This behaves the same as address="".

2) http://localhost/Appfolder/WcfSlPortal.svc?wsdl returns result HTTP/1.1 500 System.ServiceModel.ServiceActivationException.

3) http://1.2.3.4/Appfolder/WcfSlPortal.svc where 1.2.3.4 = IP Address of IIS server returns result HTTP/1.1 200 OK. This behaves the same as address="".

4) http://1.2.3.4/Appfolder/WcfSlPortal.svc?wsdl where 1.2.3.4 = IP Address of IIS server returns result HTTP/1.1 500 System.ServiceModel.ServiceActivationException

So now I'm closer but still no joy.

Any other thoughts?

tgddev replied on Wednesday, June 16, 2010

Sorry, I've never suffered the activation exception.

Good luck.

rnb replied on Wednesday, June 16, 2010

One WCF activation I had to do is in Control Panel | Program and Features | Turn Windows features on or off, mine is under .NET Framework 3.5.1 it might apply to 4.0 as well.

Copyright (c) Marimer LLC