WCF Service - "The remote server returned an error: NotFound."

Discussion in 'ASP.NET WebServices' started by djordan, Sep 28, 2009.

  1. Hi, I have been working on this for several weeks now and I can't seem to figure out where I am going wrong. I have seen many threads on many forums with similar issues but when I try to implement them they still don't work. Below is my code.

    using System.ServiceModel;
    using System.ServiceModel.Activation;
    namespace SilverlightApplication2.Web
        [ServiceContract(Namespace = "http://www.chicagoquant.com")]
        public interface ITestService
            string TestConnection();
    using System.ServiceModel;
    using System.ServiceModel.Activation;
    namespace SilverlightApplication2.Web
        [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
        public class TestService : ITestService
            public string TestConnection()
                return "SUCCESS!!";
    Service model portion of Web.Config
        <behavior name="SilverlightApplication2.Web.TestServiceBehavior">
         <serviceMetadata httpGetEnabled="true" />
         <serviceDebug includeExceptionDetailInFaults="false" />
        <binding name="customBinding0">
         <binaryMessageEncoding />
         <httpTransport />
       <serviceHostingEnvironment aspNetCompatibilityEnabled="true">
           <add prefix="http://www.chicagoquant.com"/>
      <!--<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />-->
       <service behaviorConfiguration="SilverlightApplication2.Web.TestServiceBehavior"
        <endpoint address="" 
                  contract="SilverlightApplication2.Web.ITestService" />
        <endpoint address="mex" 
                  contract="IMetadataExchange" />
                    <binding name="BasicHttpBinding_ITestService" 
                        <security mode="None" />
                <endpoint address="http://www.chicagoquant.com/TestService.svc" 
                          name="BasicHttpBinding_ITestService" />
    <?xml version="1.0" encoding="utf-8"?>
          <allow-from http-request-headers="SOAPAction">
            <domain uri="*"/>
            <resource path="/" include-subpaths="true"/>
    <%@ ServiceHost Language="C#" Debug="true" Service="SilverlightApplication2.Web.TestService" CodeBehind="TestService.svc.cs" %>
    I am calling the service from a silverlight application and just trying to change a text box as a test. Any ideas or suggestions would be greatly appreciated.

  2. Bruce

    Bruce DiscountASP.NET Staff

    what is the problem?
  3. When I the page loads I have a silverlight application that that tries to subscribe to the webservice that I setup above. However, I keep getting the error "The remote server returned an error: NotFound." When I run the project on my local machine it works fine. It's just when I try and deploy it that i receive the error.
  4. Bruce

    Bruce DiscountASP.NET Staff

    I tested the service directly and it seems to be working fine. If you are getting a Notfound error, you probably specified a wrong URL or somthing.
  5. Did you ever get this working? I'm having the same issue.
  6. "Not Found"...same problem

    Did anyone ever figure this out? We have the same problem System.Windows.Ria.DomainOperationException: Load operation failed for query "GetUsers". The romote server returned an error: NotFound
  7. I've not seen this problem with an application hosted on the DASP platform, but I have seen this same problem today with a Silverlight application hosted locally on my development box. It had me confused for a while but in the end I solved it by:
    • First specifying includeExceptionDetailInFaults="true" on the service behaviour.
    • Next when this first option didn't expose any further information, I ran a fiddler trace on the line to inspect the raw header response.
    In my case it turned out to be something silly I had done with the class that implemented my WCF service contract: I had put PrincipalPermission(SecurityAction.Demand, Authenticated=true) at class level which was not good (in my scenario at least) because the thread instantiating my WCF class was not authenticated. I moved the PrincipalPermissionAttribute down to the method level and this fixed the problem.

    I'm not suggesting that the cause will be the same in every case, but using the fiddler tool was definitely the thing that pointed me in the right direction.
  8. Can you change the SOAPHeaders in the crossdomain xml to:

    <allow-from http-request-headers="*"> ?

Share This Page