none
Common DomainService errors and solutions

    Question

  • Whether you're starting from scratch or you're upgrading from the July CTP bits, you may run into a few issues. Hopefully this thread will provide solutions for those issues. If after reading this thread you're still unable to get your service working, please check if a different thread exists for your problem, or post a new thread. We'll help you resolve the problem and add it to this list if it turns out to be a common problem people run into.

    Problem 0: You are getting a NotFound error in your Silverlight application.

    Silverlight's browser networking stack can only handle responses with status code 200. Any other kind of response will be reported as a 404 NotFound error.

    A DomainService will take care of reporting exceptions that happen within our pipeline as responses with status code 200, such that errors are still reported in Silverlight. However, when an error happens outside of our pipeline (e.g. during the activation of a DomainService), we can't report the error within a 200-response.

    To see what the problem is, you can usually directly navigate to the DomainService using a browser. If you have a DomainService called HRApp.Web.ProductService hosted at http://localhost/HRApp/, then try navigating to http://localhost/HRApp/Services/HRApp-Web-ProductService.svc. (Notice how the dots are replaced with dashes.) If everything is fine, you should get a help page with a link to the WSDL for your service. If something is wrong, you will get an error from ASP.NET with hopefully more details.

    Problem 1: WCF is not activated.

    RIA services is now built on top of WCF. As a result, we require WCF to be activated on the server. You can activate WCF by going to Add Programs and Features -> turn Windows features on or off -> Microsoft .NET ... -> WCF HTTP activation.

    Problem 2: The website is configured to have multiple addresses/host headers.

    You can confirm this is what you're running into by navigating to your DomainService (see "problem 0" on how to do that). You should get something related to UriSchemeKeyedCollection and multiple addresses with the same scheme.

    We are working on a fix to this problem. In the meantime, you can get your service working with one address by plugging in a custom DomainServiceHostFactory. Note that you will have to do this for every DomainService in your project.

    1. (One time only.) Add the following class to your project:

    public namespace System.Web.Ria {
        public class DomainServiceHostFactoryEx : DomainServiceHostFactory {
            protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses) {
                return new DomainServiceHost(serviceType, FilterAddresses(baseAddresses));
            }

            private static Uri[] FilterAddresses(Uri[] baseAddresses) {
                return baseAddresses.GroupBy(uri => uri.Scheme).SelectMany(uri => uri).ToArray();
            }
        }
    }

    2. Plug-in the factory to every DomainService. Create an .svc file (using the naming convention as described in "problem 0") and put it in the ~/Services directory of your application. In each .svc file, put:

    <%@ ServiceHost Service="<DomainService full type name>" Factory="System.Web.Ria.DomainServiceHostFactoryEx" %>

    Problem 3: Access denied/Unable to connect to the SQL server database errors.

    When logging in, the AuthenticationService does three things:

    1. Get/initialize the user object.
    2. Get the roles for the user.
    3. Get the profile for the user.

    Make sure that in your web.config you either disabled roles/profiles if you don't need it, or otherwise make sure both roles/profiles are configured properly. E.g. if you're using a SQL server DB, you'll want to use the right connection string for both roles and profiles. By default ASP.NET will try to create/use a DB in the App_Data directory, so if you get an error related to access to the App_Data directory, then double check that you've set up all the connection strings properly and use them in all the right places.

    Monday, November 23, 2009 7:47 PM

All replies

  • Thank you for offering to fix this "multiple host headers on one website WCF issue". As you know, it has been around for a long time. See:

    https://connect.microsoft.com/wcf/feedback/ViewFeedback.aspx?FeedbackID=322896

    Microsoft has the best development tooling in the world. The RIA services story is great and promises that we can create LOB applications fast and easy. We need the ability to easily deploy our RIA services application.

    Tuesday, November 24, 2009 8:33 AM
  • Just to confirm, Problem 2 comes from a limitation in WCF 3.5 and before and is fixed in WCF 4 beta 2. The fix that is being worked on for Problem 2 will be an update for WCF 3.5 to allow multiple host headers to be used with http and https bindings?

    If the "fix" is to upgrade to WCF 4, that will leave the majority of us stuck until we can migrate our development to VS2010 and .Net 4. Also, the work around will not work for many of us as it simply filters out all of the host headers except the first one. While this prevents the error from occuring in the service it does not allow the service to be referenced from the other host headers (dns entries). This has been a very painful issue for many of us for a long time and has prevented some of us from moving to WCF at all.

    Any information on if this fix will work with VS2008 / .Net 3.5 is much appreciated.

    Thanks!

    Ian

    Tuesday, November 24, 2009 2:29 PM
  • 1. (One time only.) Add the following class to your project:

    public namespace System.Web.Ria {
        public class DomainServiceHostFactoryEx : DomainServiceHostFactory {
            protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses) {
                return new DomainServiceHost(serviceType, FilterAddresses(baseAddresses));
            }

            private static Uri[] FilterAddresses(Uri[] baseAddresses) {
                return baseAddresses.GroupBy(uri => uri.Scheme).SelectMany(uri => uri).ToArray();
            }
        }
    }

    I am unable to figure what this means. If I simply paste this into a class file I get error such as "A namespace declaration cannot have modifiers or attributes". I am sure thiere is something I am doing wrong but the directions simply say "Add the following class to your project".

    Tuesday, November 24, 2009 10:05 PM
  • Try removing the 'public' from the start of the namespace, probably should just be:

    namespace System.Web.Ria {
        public class DomainServiceHostFactoryEx : DomainServiceHostFactory {
            protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses) {
                return new DomainServiceHost(serviceType, FilterAddresses(baseAddresses));
            }

            private static Uri[] FilterAddresses(Uri[] baseAddresses) {
                return baseAddresses.GroupBy(uri => uri.Scheme).SelectMany(uri => uri).ToArray();
            }
        }
    }

    Wednesday, November 25, 2009 9:24 AM
  • Try removing the 'public' from the start of the namespace, probably should just be:

    namespace System.Web.Ria {
        public class DomainServiceHostFactoryEx : DomainServiceHostFactory {
            protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses) {
                return new DomainServiceHost(serviceType, FilterAddresses(baseAddresses));
            }

            private static Uri[] FilterAddresses(Uri[] baseAddresses) {
                return baseAddresses.GroupBy(uri => uri.Scheme).SelectMany(uri => uri).ToArray();
            }
        }
    }

    Thank you, but now I get the error:

    'System.Array' does not contain a definition for 'GroupBy' and no extension method 'GroupBy' accepting a first argument of type 'System.Array' could be found (are you missing a using directive or an assembly reference?)

    Wednesday, November 25, 2009 11:51 AM
  •  make sure you add a using System.Linq;  to the top of the class.

    Wednesday, November 25, 2009 11:56 AM
  •  make sure you add a using System.Linq;  to the top of the class.

    Thank you. This is the complete code that compiles:

    using System.Web.Ria.Services;
    using System.ServiceModel;
    using System.Linq;  
    namespace System.Web.Ria
    {
        public class DomainServiceHostFactoryEx : DomainServiceHostFactory
        {
            protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses)
            {
                return new DomainServiceHost(serviceType, FilterAddresses(baseAddresses));
            }
    
            private static Uri[] FilterAddresses(Uri[] baseAddresses)
            {
                return baseAddresses.GroupBy(uri => uri.Scheme).SelectMany(uri => uri).ToArray();
            }
        }
    } 
     
    Wednesday, November 25, 2009 12:12 PM
  •  Hi.

    I used RIA_Services_Walkthrough 2009. Created HRApp exactly as in tutorial. Everithing works fine when launching from Visual Studio 2008.

    But when I press publish on HRApp.Web and try to launch as localhost/HRApp.Web/HRAppTestPage.aspx - i get error Not Found.

    I have Windows 2008 Server with IIS 7. WCF Http Activated.

    in Problem 0 description you recomend to try http://localhost/HRApp/Services/HRApp-Web-ProductService.svc

    But i haven't  see this svc-files in Services folder. Only AuthenticationService.cs, UserRegistrationService.cs which are there by default.

    So my question is: what I have to do to work with IIS ?

    Thursday, November 26, 2009 5:04 AM
  • You are probablly missing the RIA Services dlls on the server side. In the references make sure they are set to copy local. The Not Found error is actually meaningless, the Silverlight networking stack always says that regardless of the actual error. It is important to have Fiddler installed so that you can see the actual error.

    There is no actual svc file, the service is setup implicitly at runtime.

    Thursday, November 26, 2009 10:03 AM
  • Quick question: Would adding this to the config also solve problem 2?

    <serviceHostingEnvironment>
         <baseAddressPrefixFilters>
            <add prefix="http"/>
         </baseAddressPrefixFilters>
    </serviceHostingEnvironment>

    Here is the MSDN article about it:

    http://msdn.microsoft.com/en-us/library/bb924481.aspx

    Thursday, November 26, 2009 11:12 AM
  • Im trying to fellow this walkthough

    http://msdn.microsoft.com/en-us/library/ee796239(VS.91).aspx

    But when I try to drag data from the Data Sources window, I found there is nothing but "You project currently has no data source associated with it."

    Anyone know how to fix it?

    Im using Windows 7 x64+VS2010 Beta2+Silverlight 4 Beta Tools for VS 2010

    Saturday, November 28, 2009 8:20 AM
  • eraservsv: The .svc file doesn't exist physically in your project. It is created virtually (by RIA services) when you first request it.

    Monday, November 30, 2009 1:26 PM
  • I tried all the outlined steps as follow:

    My server  project is WizardRIA.Web

    So a created a directory Services  and placed my  SVC file there

    <%@ ServiceHost Service="WizardRIA.Web.GreenDomainService"    Factory="System.Web.Ria.DomainServiceHostFactoryEx" %>I created a class  as instructed:using System.Web.Ria.Services;using System.ServiceModel;using System.Linq;  namespace System.Web.Ria{    public class DomainServiceHostFactoryEx : DomainServiceHostFactory    {        protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses)        {            return new DomainServiceHost(serviceType, FilterAddresses(baseAddresses));        }         private static Uri[] FilterAddresses(Uri[] baseAddresses)        {            return baseAddresses.GroupBy(uri => uri.Scheme).SelectMany(uri => uri).ToArray();        }    }

    }

    I then confirmed that this code is being called  (break point)and works fine on local server but when I upload to my ISP (DiscountASP) I still get the 404. I am curious as to how the provided code is addressing the problem as it is still returning a collection. DiscountASP has a article that shows the following:

    Public class MyServiceHostFactory:ServiceHostFactory
    {
     protected override ServiceHost CreateServiceHost(Type serviceType,Uri[]baseAddresses)
    {
    //Specify the exact UR Lof your webservice Uri webServiceAddress=newUri("
    http://www.domain.com/WCFService/Service.svc");
    MyServiceHost webServiceHost=new MyServiceHost(serviceType,webServiceAddress);
    return webServiceHost;
    }
    }

    public class MyServiceHost:ServiceHost
    {
    public MyServiceHost(Type serviceType,params Uri[]baseAddresses)
    :base(serviceType,baseAddresses)
    {}

    protected override void ApplyConfiguration()
    {
               base.ApplyConfiguration();
    }
    }

     Then of course what is the real problem on the server as I can no longer use WCF trace as it creates a local file that I have no access to

     

    Tuesday, December 01, 2009 3:12 PM
  • Sorry about the lack of line breaks but I tried to edit the post and the action crashes the toolAngry

    Tuesday, December 01, 2009 3:14 PM
  •  John. How exactly are you trying to get to your external website.

    I've found that if use www.hillsgate.com I get a 404 error, but if I go there using just hillsgate.com then it works fine. I don't know why I cannot use www. (I wish I could work it out because that's how I would like to do it)...

    Try it out on your site.

    Tuesday, December 01, 2009 3:25 PM
  • Thank you. This is the complete code that compiles:

     

    However I never got this code to prevent the problem. It compiles but it did not work for me. I had to simply hardcode the URL. I have a working example of my code and the source code at this link:

    WCF RIA Services

    Tuesday, December 01, 2009 4:09 PM
  • steyoung : I tried this and no luck , the only way to get the real error on DiscountASP is a WCF Trace which I believe writes to a file or a Event log. I do not think that I can get either from them so sounds like I am stuck. WCF is a powerful framework but it sure complicates what was a simple tool.

    Tuesday, December 01, 2009 7:22 PM
  • I hear you John. It took me three days to get everything running. Getting things updated because of the breaking changes took about an hour and then getting it running on wcf took the remainder of the time Now a lot of that was the good folks at msoft doing their thing with all the error reports coming in from a whole cadre of people, but... it's still 3 days!

    Plus there are still some gotchas such as with the .svc files etc but I understand that an update will be coming out to fix this issue we're stumbling over. I'm looking forward to it.

    Once it's running it's really cool. 

    Here are the things I needs to do to get it running.

    • Put the .svc files into commission in /Services
    • Add WilcoB's code (as defined in this post above)
    • Ensure WCF services was enabled at my host
    • Add a mime type for .svc in config.sys
      • <staticContent>
              <mimeMap fileExtension=".svc"  mimeType="application/octet-stream" />
            </staticContent>
    • set copy local on all the Web dlls and ComponentModel.DataAnnotations
    • Use http://hillsgate.com and not www.hillsgate.com
    • Ensure when I published that the svc files etc all copied
    • Changed the website authentication to
      • Allow Anonymous Access - true
      • Enable Integrated Windows Authentication - false
      • Enable Basic Authentication - False
    • Ensured asp.net Authentication, Profile & Roles all had providers or were set to be disabled

    Once I had all that done, then it worked fine

    Steve

    Tuesday, December 01, 2009 7:42 PM
  • steyoung: are u running successfully on an ISP like DiscountASP, I have no problrm with my local IIS?

    Wednesday, December 02, 2009 8:10 AM
  • Yes I'm running on a hosted provider. I use softsyshosting. The only thing I missed from my list is it needs to be in a full trust environment. All my domains have full trust so it didn't apply to me but I know someone had that issue.

    Wednesday, December 02, 2009 9:25 AM
  • Finally I got mine working as there was a couple of issues that were mostly careless mistakes on my part and finally forcing the real problem by typing in the nnnn.svc into the browser which showed me the issue was :

    IIS specified authentication schemes 'Basic, Anonymous', but the binding only supports specification of exactly one authentication scheme. Valid authentication schemes are Digest, Negotiate, NTLM, Basic, or Anonymous.

    Change the IIS settings so that only a single authentication scheme is used.

     discount.asp made the change and I am running but what a battle! I alsp noticed that there was a transport level error from Mozilla but I can live with that right now

     

    Thursday, December 03, 2009 9:50 PM
  • I should add that i had to  change the code in the nnn.svc.cs file to:

    return new DomainServiceHost(serviceType, baseAddresses[0]);

    Friday, December 04, 2009 11:17 AM
  •  Sorry I wasn't clear in my list of things to work through (and the system isn't allowing me to edit my post to change it), but when I said change website authentication to:

    Allow Anonymous Access to true and the others to false,  I intended to say that you could only choose one. If multiple are set, it doesn't seem to work.

    I'm not saying that I understand why, I'm just outlining my empirical findings based on trying things for 3 days...

    I'm glad you finally got yours running.

     Steve

    Friday, December 04, 2009 11:36 AM
  • Hello, I tried the solution outlined on Problem 2. It works perfectly on my local machine, but when I upload it to a webserver (Windows Server 2003) I keep getting this error:

     This collection already contains an address with scheme http.  There can be at most one address per scheme in this collection.
    Parameter name: item

    I have already created the factory method Factory Class:
    using System.Web.Ria.Services;
    using System.ServiceModel;
    using System.Linq;
    namespace System.Web.Ria
    {
        public class DomainServiceHostFactoryEx : DomainServiceHostFactory
        {
            protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses)
            {
                return new DomainServiceHost(serviceType, FilterAddresses(baseAddresses));
            }
    
            private static Uri[] FilterAddresses(Uri[] baseAddresses)
            {
                return baseAddresses.GroupBy(uri => uri.Scheme).SelectMany(uri => uri).ToArray();
            }
        }
    }

    And added the svc file for all the Domain Services on the project:

     <%@ ServiceHost Service="Xmas.Web.XmasDomainService" Factory="System.Web.Ria.DomainServiceHostFactoryEx" %>

    Questions:

    1. I'm used the WCF Service template to create the svc files, is this correct?

    2. Is it ok that I created the svc file for the AuthenticationService and UserRegistrationService (which already come with the Silverlight Business App template)?

    3. Is there anything I should install on the web server?

    Friday, December 04, 2009 12:16 PM
  • I also get the his collection already contains an address with scheme http.issue and when i modified CreteServiceHost to look at the first address only i started getting the following

     

    IIS specified authentication schemes 'IntegratedWindowsAuthentication, Anonymous', but the binding only supports specification of exactly one authentication scheme. Valid authentication schemes are Digest, Negotiate, NTLM, Basic, or Anonymous. Change the IIS settings so that only a single authentication scheme is used.
    Monday, December 07, 2009 7:05 AM
  • steyoung: i am also using softsyshosting. but i am still missing something. As soon as i change authentication to "anonymous only" i start getting 404 when click on my .svc file. thanks
    Monday, December 07, 2009 9:08 AM
  • steyoung: i am also using softsyshosting. but i am still missing something. As soon as i change authentication to "anonymous only" i start getting 404 when click on my .svc file. thanks

    I had to restart my web server to get the new setting to work when I fixed this on my server.

    Monday, December 07, 2009 9:26 AM
  • jamolina, it seems that the code in your factory is not being executed for that message is the result of the problem the code is addressing I made sure chnaging my svc file to

    <%@ ServiceHost Service="WizardRIA.Web.GreenDomainService" CodeBehind="WizardRIA-Web-GreenDomainService.svc.cs" Factory="System.Web.Ria.DomainServiceHostFactoryEx" %>

    and i also changed the svc.cs code to

    protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses)

    {

     

    return new DomainServiceHost(serviceType, baseAddresses[0]);

    }

    I then had my ISP  disable Basic Authentication on the Web application, so only Anonymous is enabled.

    It worked for me hope it does for u

    Monday, December 07, 2009 9:50 AM
  • Hi Kilativ. I'm not sure what you mean when you say you click on the .svc file. As I described in my 'steps' posting above, once you have checked through all the steps, the only issue remaining is that you may not be able to access your web site using the www prefix e.g. www.xyz.com, you may have to use just xyz.com or http://xyz.com

     Steve

    Monday, December 07, 2009 11:38 AM
  • Sorry, i mean when i go to http://mydomain.com/myservice.svc (i was clicking on it with browse directory on). some how it's throws 404 page not found as soon as i turn off windows integrated authentication and leave only anonymous on.
    Monday, December 07, 2009 11:49 AM
  •  Mine works if I use this:

    htp://mydomain.com/Services/myapp-Web-mydomainservice.svc

    I assume that you have placed your .svc file in the /Services folder

    Try this which is my .svc file 

    http://hillsgate.com/services/RealMax-Web-RealMaxDomainService.svc

    Monday, December 07, 2009 12:21 PM
  • Is there a reason for bulletpoint "1" you have? to put .svc into a Services folder? thanks
    Monday, December 07, 2009 12:40 PM
  •  My understanding is that the system expects the .svc files to be in /Services

    Monday, December 07, 2009 12:47 PM
  •  My understanding is that the system expects the .svc files to be in /Services

    Right, if you don't put it in the /Services folder then WCF RIA Services will still generate its own SVC at runtime instead of using yours.

    Monday, December 07, 2009 12:56 PM
  • Thank you very much everybody. Everything does work now! Couple of notes:

    I didn't have to do anything to allow WCF or to add mime-types. My guess the hosting company has those by default.

    You do need to make sure you have full trust for Entity Framework to work.

    I had to create 2 extra .svc files for AuthenticationService and UserRegistrationService so they'd use the same Factory.

    Monday, December 07, 2009 10:05 PM
  • Hey jmcfet, thanks a lot for answering. Actually the code was hitting the factory (I checked this debugging on my local computer) but I was still getting the error.

    I gave your suggestion a shot, but it keeps happening. Debugging in my computer I noticed that it actually never enters into the CreateServiceHost override on the svc.cs file. I don't know if I did it correctly. Am I suppose to inherit from DomainServiceHostFactoryEx on the svc.cs file? Or what is that method suppose to override?

     

        public class Xmas_Web_AuthenticationService : DomainServiceHostFactoryEx, IXmas_Web_AuthenticationService
        {
    
            protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses)
            {
                return new DomainServiceHost(serviceType, baseAddresses[0]);
            }
    
            #region IXmas_Web_AuthenticationService Members
    
            public void DoWork()
            {
                
            }
    
            #endregion
        }
      
    Wednesday, December 09, 2009 12:16 AM
  • Try making CreateServiceHost a part of your DomainServiceHostFactoryEx
    Wednesday, December 09, 2009 7:45 AM
  • So I am having problem 0.  I navigated to the said URL and I got a slightly more helpful ASP.NET message:

    "The resource cannot be found. "

    OK... maybe not that much more helpful! :)

    As for Problem 1,  your instructions for "activating WCF" seem to apply to IIS 7 or Server 2008 since I am on Server 2003 / IIS 6.0 and I don't have those options.  In any case, I have other WCF apps running on this server just fine so I don't think WCF is the problem?

    Problem 2 should be a non-issue on this site as it is only configured for one address.  I have fixed this problem in other WCF apps but it shouldn't apply here.

    I am in the same boat as others here...  everything works just fine locally but as soon as I deploy nothing works any more. 

    Steps I have taken:

    1) Copied all the appropriate .dlls (listed here and elsewhere but I am sure I have all of them)

    2) Made sure I am running Full Trust in IIS

    3) Made sure my other WCF services are running fine

    4) Restarted the app pool and site

    5) Navigated to every possible /Services/ URL that I could think of that might make sense given the service name and namespace... nothing works

    Fiddler just gives me a 404 but apparently that is meaningless.  Given that I can't find the service is seems that I am missing something else but I can't figure out for the life of me what is missing. 

     Any other suggestions?

     

    Wednesday, December 09, 2009 2:28 PM
  • Fiddler just gives me a 404 but apparently that is meaningless.  Given that I can't find the service is seems that I am missing something else but I can't figure out for the life of me what is missing. 

    Fiddler showing you a 404 isn't meaningless, it is when Silverlight reports a 404 that it is meaningless. If Fiddler is showing 404 it means either the DomainServiceModule isn't running at all or the DomainServiceModule can't find the DomainService.

    Wednesday, December 09, 2009 3:17 PM
  • What is the namespace and the class name you are trying to reach as a service?
    Wednesday, December 09, 2009 3:19 PM
  • Ah, I misunderstood what Wilco was trying to say then.  So... I have the following in my web.config:

    <modules>
          <remove name="ScriptModule" />
          <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
          <add name="DomainServiceModule" preCondition="managedHandler" type="System.Web.Ria.Services.DomainServiceHttpModule, System.Web.Ria,Version=2.0.0.0,Culture=neutral,PublicKeyToken=31BF3856AD364E35"/>
    </modules>

    And the System.Web.Ria.dll is in the bin directory on the web site so I assume that it is running?  What would I be looking for that would indicate that it is not running? 

    If it is running and can't find the DomainService, what would be some reasons for this given that it apparently can find it in WebDev but not under IIS? 

     

    Wednesday, December 09, 2009 4:22 PM
  • I am trying to access the .svc using the conventions outlined in this post:

    Understanding the WCF in ‘WCF RIA Services’

    Specifically:

    <quote>

    [SilverlightApplicationBaseURI] + [DomainServiceFullName].svc (With all “.” replaced by “-“)

    So HRApp.Web.OrganizationService is exposed as – http://[ApplicationBaseURI]/HRApp-Web-OrganizationService.svc

    </quote>

     Although I also tried accessing it at the ~/Services/<DomainService.svc> URL because apparently that is where the redirect is supposed to take place? 

    In any case, no luck at all finding it... 

    Wednesday, December 09, 2009 4:57 PM
  • Is the DomainService within the web project or is it in a WCF RIA Services class library? If it is in a class library did you make sure the dll was copied into the web site?

    Wednesday, December 09, 2009 5:05 PM
  • It is in a RIA Services class library and yes that .dll is in the bin directory on the web site.

    I also removed all the DomainServiceModule references from the web.config and added a DomainService to the web site via the Domain Service wizard to let it recreate the web.config lines for me.  It did but I still cannot access any of the DomainServices, either the one in the RIA class library or the newly added one in the web site itself. 

    To reiterate, I *can* see the WCF service that is sitting on the same web site so I know that WCF is working.. just not the RIA WCF.

    Are there potential conflicts between an existing WCF service and a RIA WCF that I am not seeing?

     

    Wednesday, December 09, 2009 5:23 PM
  • In an earlier thread WilcoB had suggested placing this method:

    [Invoke(HasSideEffects=false)]
    public string Echo() {
      var b = OperationContext.Current.Host.Description.Endpoints[0] as WebHttpBinding;
      return b.Security.Mode + " - " + b.Security.Transport.ClientCredentialType;
    }

    In a DomainService and trying to call it.  I had done that but with no luck.  Just now tried creating a physical .svc file that pointed at this service and the error I got back mystified me but might point to my problem:

    "The CLR Type 'System.Web.Ria.DomainServiceHostFactory' could not be loaded during service compilation."

    I double checked and the System.Web.Ria.dll IS in the \bin directory and all the version numbers match up.  Any thoughts on why it can't load it?

    Wednesday, December 09, 2009 6:07 PM
  • Maybe one of the dependencies is missing? i had to copy the following DLLs:

    System.ComponentModel.DataAnnotations.dll
    System.Web.DomainServices.dll
    System.Web.DomainServices.EntityFramework.dll
    System.Web.Ria.dll

    Wednesday, December 09, 2009 7:04 PM
  • I wish it were that simple! :)  All of the .dlls that have been mentioned here and in other posts, along with every .dll that is referenced in any of the projects are available either in the bin or as part of the Framework (2.0, 3.0 and 3.5 are all installed on the server). 

    Wednesday, December 09, 2009 7:11 PM
  • Did you try to deploy it without regular web services in the same app? Maybe you are right and they cannot co-exist together. I'd be very surprised and disappointed but it's a good test to try.
    Thursday, December 10, 2009 9:58 AM
  • I thought about that but removing the WCF services renders the app useless since [Invoke] operations can no longer handle entity types.  This was the topic of another thread and it was suggested by some WCF RIA guys that we should move those type of calls outside of the RIA framework and let stand-alone WCF services handle those. 

    The curious thing is that the entire app runs locally with no problem... it's only when deployed that there is a problem.  Spent the entire day yesterday looking for the magic pixie dust that would make it run but still no go!  Hopefully I can find the solution before the decision is made to abandon WCF RIA... I am sold but not everyone in management is!

     

    Thursday, December 10, 2009 11:12 AM
  • The curious thing is that the entire app runs locally with no problem... it's only when deployed that there is a problem.
     

     

    Sorry if I'm repeating things you've already tried - I quite possibly missed one of your previous posts...


    I had a problem deploying my first app with the new WCF RIA Services bits, even though it ran fine on local IIS.

    To trace, I dug into the generated client side service code and found the DomainContext constructor with the hardwired relative URI ...it looked like this:

    MyWebApp-Web-MyDomainService.svc

    I copied that and in a browser URL bar, appended it to the remote hosting domain:

    http://my.domain.com/MyWebApp-Web-MyDomainService.svc

    There I got a semi-useful exception message that indicated what I needed to do to see a detailed exception message (add a simple entry to the <customErrors> section of the web.config).  After doing that and browsing to the service URL again, I got a full exception trace and was able to track down the fix quickly.  In my case, I had multiple IIS bindings configured for the site - www.my.domain.com, my.domain.com, etc...

    If you don't get anything when browsing directly to the service, then there's not even a valid endpoint running for the service.

     

    Thursday, December 10, 2009 3:14 PM
  • Mark, thanks for the reply.  I don't have multiple endpoints configured and I have already established that I don't have a valid endpoint running.  What I don't know how to do is figure out *why* there are no endpoints running.  I have a separate WCF service that is running just fine... just no WCF RIA services running.

     I would love to hear from someone knowlegeable about the inner workings of WCF RIA as to what steps I can take to track down the real problem.  I know it isn't running... I just don't know why or how I can start tracking down the problem.

     

    Thursday, December 10, 2009 3:35 PM
  • Thanks to everyone, what I had to do was actually remove the whole factory thing and add this to my web.config file:

     

    <system.serviceModel>
     <serviceHostingEnvironment aspNetCompatibilityEnabled="true">
       <baseAddressPrefixFilters>
         <add prefix="http://some.url.here.that.matches.a.host.header"/>
       </baseAddressPrefixFilters>
     </serviceHostingEnvironment>
    </system.serviceModel>
     

     Here is a great post by Tim Heuer on troubleshooting RIA Services deployment:

    http://timheuer.com/blog/archive/2009/12/10/tips-to-deploy-ria-services-troubleshoot.aspx?utm_source=Twitter-timheuer

    Thursday, December 10, 2009 4:43 PM
  • Hosting RIA services on shared hosting environment and without changing anything on IIS or RIA code. Just few lines in your web.config...

    yes it is possible.. check yourself at url :http://rajneeshnoonia.blogspot.com/2009/12/ria-wcf-configuration-finally-resolved.html

    Cheers
    Rajneesh Noonia

     

    Thursday, December 10, 2009 5:02 PM
  • If url/link misbehaves please check on http://rajneeshnoonia.blogspot.com/

    Thursday, December 10, 2009 5:07 PM
  • Jamolina: i think this is the best solution. No code changes, no workarounds like taking the first element in the collection. Just configuration. It works, i just tried it. Also made it easier for me to setup a second domain pointer to my app. Thanks for posting this.
    Thursday, December 10, 2009 11:03 PM
  • Out of curiosity...  has anyone else been able to get WCF RIA to work using a Web Deployment Project?  After 2 days of fruitless searching and consistenly getting a 404 where a service should have been, I used Publish instead of Deploy and presto... everything worked.

    Any chance it's just a fluke on my dev box or is this really a gaping hole in the WCF RIA story?

    Monday, December 14, 2009 4:46 PM
  • FWIW, I am hoping the SL / WCF RIA teams understand how important a smooth deploy process is for SL adoption. 

    A *big* part of our decision to go with SL instead of Flex was that we already had all the tools and processes in place for deploying ASP.NET applications.  We didn't want to have the pain of having to shoe-horn a different technology into our current process. 

    This last week was almost a plug-pulling moment for us and we are already heavily invested in SL / WCF RIA.  I know it's beta but it's not a good thing when so many people are having this much trouble just deploying an app.

    Cool technology is good.  Working technology is better.  Cool working technology that you can put to work for you... you can't beat that.

     

    Tuesday, December 15, 2009 12:35 PM
  • FWIW, I am hoping the SL / WCF RIA teams understand how important a smooth deploy process is for SL adoption. 

    They do understand that, and it is experiences like your own that will help make sure that the final product has better deployment guidance.

    I do find it interesting that simply changing your deployment method fixed the problem. I am not really sure what it means, but it is certainly interesting.

    Tuesday, December 15, 2009 12:49 PM
  • I know it's beta but it's not a good thing when so many people are having this much trouble just deploying an app.

    Cool technology is good.  Working technology is better.  Cool working technology that you can put to work for you... you can't beat that.

    I can assure you this has been communicated to the team. The do "get it" and I am confidant they will address the issues.

    Tuesday, December 15, 2009 12:49 PM
  • opps my problems are back as i am again getting 404 and this time I use fiddler and see the following details in addition to the 404:

    [EndpointNotFoundException]: There was no channel actively listening at 'http://www.sandkeysoftware.com/WizardRIA.Web/Services/WizardRIA-Web-GreenDomainService.svc/binary'. This is often caused by an incorrect address URI. Ensure that the address to which the message is sent matches an address on which a service is listening.

    Now my factory code looks like:

    namespace System.Web.Ria

    {

    public class DomainServiceHostFactoryEx : DomainServiceHostFactory

    {

     

    protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses)

    {

    return new DomainServiceHost(serviceType, FilterAddresses(baseAddresses));

    }

    I also tried the following as it seemed to be working for a while:

    return new DomainServiceHost(serviceType, baseAddresses[0]);

    my svc markup is

    <%@ ServiceHost Service="WizardRIA.Web.GreenDomainService" CodeBehind="WizardRIA-Web-GreenDomainService.svc.cs" Factory=" System.Web.Ria.DomainServiceHostFactoryEx" %>

    of course the solution works fine on my local IIS and am puzzled for an svc extension is being mapped by discountasp so the service should be activated by IIS

    Tuesday, December 15, 2009 3:28 PM
  • ok I finally got mine to work as i noticed that I only got the "Endpoint missing" if I had the /binary on the end of my service url as in //my site/myservice.svc/binary as soon as I removed the binary then my calls started working.
       My understanding is the binary is to use WCF Binary encoding on the channel so the calls should be more efficient. Is there something I have to ask my ISP to do let this work?

    As an aside working on this problem really shows me how valuable fiddler is as most WCF clients not just SL will mask the real exceptions on the server. But this stuff in its current stage is way to complex and I look forward to seeing the released code

    Wednesday, December 16, 2009 11:39 AM
  • ok I finally got mine to work as i noticed that I only got the "Endpoint missing" if I had the /binary on the end of my service url as in //my site/myservice.svc/binary as soon as I removed the binary then my calls started working.

    If this was using a Silverlight client then the /binary is put on automatically. You were probaby getting /binary/binary.

    Wednesday, December 16, 2009 10:57 PM
  • Has anyone had issues deploying to an IIS 6 virtual directory? I have deployed to IIS6 web site entry and the app runs just fine, but if I map the same code to a virtual directory I get 404 errors (in fiddler) when trying to access the "virtual" svc files. Has anyone else seen this type of behavior?

     

    TIA

    Wednesday, December 23, 2009 1:03 PM
  • With the help of Colin (well, Colin deserves all the credits), we've tracked another problem with a solution.

    for NotFound issue (problem 0), can you add in there that deploying to a pre-compiled site (side-by-side with a pre-compiled site), WCF RIA does not want to work. No real solution apart from putting things in a different app root.

    Thanks.

    Friday, January 15, 2010 7:56 AM
  • Hello,

    I am very new to SilverLight and have been trying to build a small app to connect to SQL Server 2005. I am able to connect to a standalone MDF file but not to SQL Server. I get the same Not Found error.

     When I tried going to the svc file - I got the following message:

     

    The service encountered an error.

    An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
    System.NullReferenceException: Object reference not set to an instance of an object.
       at System.ServiceModel.Description.WsdlExporter.WSPolicyAttachmentHelper.InsertPolicy(String key, ServiceDescription policyWsdl, ICollection`1 assertions)
       at System.ServiceModel.Description.WsdlExporter.WSPolicyAttachmentHelper.AttachPolicy(ServiceEndpoint endpoint, WsdlEndpointConversionContext endpointContext, PolicyConversionContext policyContext)
       at System.ServiceModel.Description.WsdlExporter.ExportEndpoint(ServiceEndpoint endpoint, XmlQualifiedName wsdlServiceQName)
       at System.ServiceModel.Description.WsdlExporter.ExportEndpoints(IEnumerable`1 endpoints, XmlQualifiedName wsdlServiceQName)
       at System.ServiceModel.Description.ServiceMetadataBehavior.MetadataExtensionInitializer.GenerateMetadata()
       at System.ServiceModel.Description.ServiceMetadataExtension.EnsureInitialized()
       at System.ServiceModel.Description.ServiceMetadataExtension.HttpGetImpl.InitializationData.InitializeFrom(ServiceMetadataExtension extension)
       at System.ServiceModel.Description.ServiceMetadataExtension.HttpGetImpl.GetInitData()
       at System.ServiceModel.Description.ServiceMetadataExtension.HttpGetImpl.TryHandleDocumentationRequest(Message httpGetRequest, String[] queries, Message& replyMessage)
       at System.ServiceModel.Description.ServiceMetadataExtension.HttpGetImpl.ProcessHttpRequest(Message httpGetRequest)
       at System.ServiceModel.Description.ServiceMetadataExtension.HttpGetImpl.Get(Message message)
       at SyncInvokeGet(Object , Object[] , Object[] )
       at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
       at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
       at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)
       at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage41(MessageRpc& rpc)
       at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc)
       at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc)
       at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc& rpc)
       at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc& rpc)
       at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc)
       at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc)
       at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)
     Can you please elaborate on how to resolve this.
    Thanks & Regards
    Friday, January 15, 2010 11:55 AM
  • In debug mode, step to (or break on) the code line on which the error occurs. One of the variables in use on that line (unless there is a non steppable function which is generating the error) needs to be initialized before it is used there, i.e. "a b = new a();" or just declared "a b;".

     Marc

    Wednesday, January 20, 2010 6:25 AM
  • The solution can not solve my issue Broken Heart

    In /Services folder

    SilverlightApplication20-Web-ads.svc 

    <%@ ServiceHost Language="C#" Debug="true" Factory="System.Web.Ria.DomainServiceHostFactoryEx" Service="SilverlightApplication21.Web.Services.SilverlightApplication20_Web_ads" CodeBehind="SilverlightApplication20-Web-ads.svc.cs" %>

    DomainServiceHostFactoryEx.cs

    namespace System.Web.Ria
    {
        public class DomainServiceHostFactoryEx : DomainServiceHostFactory
        {
            protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses)
            {
                return new DomainServiceHost(serviceType, FilterAddresses(baseAddresses));
            }

            private static Uri[] FilterAddresses(Uri[] baseAddresses)
            {
                return baseAddresses.GroupBy(uri => uri.Scheme).SelectMany(uri => uri).ToArray();
            }
        }
    }

     Domain Service file:

    namespace SilverlightApplication21.Web
    {
        [EnableClientAccess]
        public class ads : AuthenticationBase<User>
        {
            // To enable Forms/Windows Authentication for the Web Application,
            // edit the appropriate section of web.config file.
        }

        public class User : UserBase
        {
            // NOTE: Profile properties can be added here
            // To enable profiles, edit the appropriate section of web.config file.

            // public string MyProfileProperty { get; set; }
        }
    }

    In client side, code:

    WebContext.Current.Authentication.Login("ggg", "ggg!!!1");

    Error:Unhandled Error in Silverlight 2 Application load operation failed for query 'Login'.The remote server retuned an error:NotFound.at

    System.Windows.Ria.OperationBase.InvokeCompleteAction()

     Thanks.

    Monday, February 22, 2010 8:39 PM
  • What do you see when you navigate directly to .svc in the browser?
    Monday, February 22, 2010 8:44 PM
  • navigate directly to .svc, it is no problem.

    details:

    You have created a service.

    To test this service, you will need to create a client and use it to call the service. You can do this using the svcutil.exe tool from the command line with the following syntax:

    Monday, February 22, 2010 8:54 PM
  • Hi, I'm "almost there" and lacking "authentication" I think..

     I have deployed a WCF RIA Services application in local. I need for it to have windows authentication, so on Web.Config I have:

    <authentication mode="Windows"/>

    Then I deploy it to the website and it is not working properly, the site loads perfectly except when it has to call the domainservice, there I get a 200 message but I get no data and no authentication..

    If I go to the svc file I can access it and get the wsdl file http://localhost/app/Services/app-DomainService-Web-AuthenticationService.svc?wsdl 

    Also based on this blog post I have set up a personalized applicationpool with identity set to NetworkService...

     I just can't get it authenticated or it to get any data..

    And, of course, it works wonderfully in local...

    Anybody, any sugerence will be much appreciated.

     

    Thanks!!

     

    Friday, March 05, 2010 7:58 AM
  • <riaControls:DomainDataSource.FilterDescriptors>
         <riaControls:FilterDescriptor IgnoredValue="" Operator="StartsWith"  PropertyPath="Contul" Value="{Binding ElementName=txtCaut, Path=Text}" />
    </riaControls:DomainDataSource.FilterDescriptors>

    I get 'StartsWith' incompatible with operand type 'String' and 'Object'

    'Contul'  is  string returned by a SP (ComplexType) returned as IEnumerable using solution found here but modificated with IEnumerable not IQueryable.

    Also there is another question about paging maybe someone knows the answer.

    Thank's

    Sorin

    Monday, March 22, 2010 9:33 AM
  • Any news on this error?

    "Unhandled Error in Silverlight 2 Application Load operation failed for
    query ..."

    Tuesday, March 23, 2010 5:55 PM
  • New link to the article (Hosting Silverlight RIA on shared web space domain) is here on my blog http://www.rajneeshnoonia.com/blog/2009/12/ria-wcf-configuration-finally-resolved/

    with sample application and live running demo application.

    Friday, April 16, 2010 4:02 PM
  • Hi,

    I have tried for few days to configure a Ria application to run on ABYSS web server and I didn't manage.

    Are there any other settings that I need to apply for the web server to know how to interpret the requests?

    I have created the mime types for silverlight plus the .svc.

    I can navigate to authentication domain service but I when I tried to call a function from that application domain I get "Not Found" from web server.(using wireshark)

    I can run the application in IIS with no errors.

    Also, I have managed to connect to a Polling duplex service hosted by Abyss server but any call to a Domain Service fails with "Not Found"

    Maybe someone can give some hints on how to troubleshot this issue.

    Kind Regards,

    Alexandru.

    Thursday, January 27, 2011 1:02 PM
  • ABYSS only supports up to ASP.NET 3.5. WCF RIA Services requires ASP.NET 4.0.

    Thursday, January 27, 2011 3:17 PM
  • Hi,

    It supports .Net 4.0 in the latest version.

    I have contacted their support and they are looking into it.

    Thanks for the fast reply.

    Kind Regards,

    Alexandru.

    Friday, January 28, 2011 5:03 AM
  • That is interesting, it would be nice if they updated their website to indicate that. Every time someone asks, I recheck their website and it never says anything about ASP.NET 4.0 support.

    Friday, January 28, 2011 7:17 AM