Deploying WCF RIA application to 2008 server RRS feed

  • Question

  • I have a Silverlight 4, .Net 4, and WCF RIA Services 1 application running fine on my Windows 7 + Visual Studio 2010 development machine but when publishing to a test server it is not working. The server is 2008 server + IIS 7. I have tried installing the RIA DLLs onto the server but still does't help. I think it might be an IIS configuration issue, but I'm not sure. Here is there error I am getting:

    System.TypeInitializationException: [TypeInitialization_Type]
    Arguments: Balenz.Web.UI.Controllers.ApplicationController
    Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See go.microsoft.com/.../ ---> System.InvalidOperationException: The current application or application host is null and the host Uri cannot be determined.
    at System.ServiceModel.DomainServices.Client.WebDomainClient`1.ComposeAbsoluteServiceUri()
    at System.ServiceModel.DomainServices.Client.WebDomainClient`1..ctor(Uri serviceUri, Boolean usesHttps, ChannelFactory`1 channelFactory)
    at Balenz.Web.Services.LicenseContext..ctor()
    at Balenz.Web.UI.Controllers.ApplicationController..ctor()
    at Balenz.Web.UI.Controllers.ApplicationController..cctor()
    --- End of inner exception stack trace ---
    at Balenz.Web.UI.Controllers.ApplicationController.get_Instance()
    at Balenz.Web.UI.App..ctor()


    Wednesday, June 9, 2010 3:11 PM

All replies

  • Ok, another piece of information. I am able to connect correctly to my service without getting this error when I open the web page from my development box. Could it be that I am missing a client DLL that needs to be included but is in the GAC on my development machine? I looked at all of the DLLs in my Silverlight app and all the ones that should be copy local are set to true. Any help would be appreciated, this is a really frustrating problem. Is it possible the application simply isn't in a state where it can determine the URL it should use when connecting to the service? What does ComposeAbsoluteServiceUri do and what is it dependent upon? Thanks, Chris
    Monday, June 21, 2010 6:41 PM
  • I just ran into the same error and I found a fix that worked for me. The ComposeAbsoluteServiceUri() function depends on App.Current having a non-null value. I had recently added a member like this to my App class:

    private MyDomainContext _domainContext = new MyDomainContext();

    My problem was that the constructor for MyDomainContext was failing, which caused the App constructor to fail, which caused Application.Current to be null, which caused ComposeAbsoluteServiceUri() to fail. In my case, using lazy creation of the member fixed the problem:

    private Lazy<MyDomainContext> _domainContext = new Lazy<MyDomainContext>();

    Check to see if your App instance is getting fully constructed.
    Tuesday, June 22, 2010 8:58 PM