none
Deployed version of RIA app doesn't interpret .svc call

    Question

  • My application runs perfectly on my machine but on the server, I get a 404 error when I check through Fiddler.

    If I run the call locally, I can run:

    http://localhost:54404/ClientBin/MyApp-Web-AuthenticationService.svc

    and I get the Service page fine.  Whe I try it on my server using:

    http://MyServer/ClientBin/MyApp-Web-AuthenticationService.svc

    I get a 404 error.  I suspect this is a server configuration or IIS7 problem but have no idea where to start looking?  I have tried uninstalling and reinstalling .net 4.0, RIA Services, aspnet_iis and have checked out the details in a number of blogs but haven't succeeded so far.  If I browse the site normally, I get the page but anything called from those services fail with the usual 'NotFound' response.

    Anyone have any ideas what I'm missing?

    Friday, August 06, 2010 9:44 AM

All replies

  • Hi,

    Please add the following to your web.config file

    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true">
          <baseAddressPrefixFilters>
            <add prefix="http://www.yourdomain.com" />
          </baseAddressPrefixFilters>
        </serviceHostingEnvironment>

     

    You can replace the <add prefix="http://www.yourdomain.com" /> with your host header value in iis.

    Thank you

    ziyad

    Friday, August 06, 2010 12:18 PM
  • "404 NotFound" is the general-all-purpose-something-went-wrong-error and doesn't really tell you anything. However your first ULR seems to use Cassini and I have incidentially just written a blog post about the issues when switching from Cassini to IIS: http://ajdotnet.wordpress.com/2010/08/08/silverlight-and-integrated-authentication/

     

    Monday, August 09, 2010 2:46 AM
  • That blog post is very helpful.  I've tried a few things on there (like setting up IIS locally as well) and I seem to be a little closer.  I can now get the site up locally on IIS.  The problem is that it can't seem to find pages properly.  I keep getting the issue:

    "No XAML was found at the location 'Views/MyApp.Web/Home.xaml"

    The address would be right if it didn't have the MyApp.Web bit added.  Any ideas what is causing that?

    Monday, August 09, 2010 5:41 AM
  • Ok, I fixed that by changing my MultipleSiteBindingEnabled attribute in the ServerHostingEnvironment to be false.  I am now getting bot my local machine and the server returning the original errors.  I think I've kinda come full circle on this but implementing IIS on my PC also should stop me getting errors on one platform that I can't replicate on the other.

    Monday, August 09, 2010 7:09 AM
  • Oops, forgot to update the current situation.  If I call the service directly on my machine, I get the following error:

    Server Error in '/' Application.

    The resource cannot be found.

    Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly.

    Requested URL: /ClientBin/MyApp-Web-AuthenticationService.svc


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

    Monday, August 09, 2010 7:12 AM
  • Following the blog, I get the following error in the event viewer:


    Log Name:      Application
    Source:        System.ServiceModel 4.0.0.0
    Date:          09/08/2010 12:10:20
    Event ID:      3
    Task Category: WebHost
    Level:         Error
    Keywords:      Classic
    User:          SYSTEM
    Computer:      MyPC.MyCompany.local
    Description:
    WebHost failed to process a request.
     Sender Information: System.ServiceModel.Activation.HostedHttpRequestAsyncResult/35230616
     Exception: System.Web.HttpException (0x80004005): The service '/ClientBin/MyApp-Web-AuthenticationService.svc' does not exist. ---> System.ServiceModel.EndpointNotFoundException: The service '/ClientBin/MyApp-Web-AuthenticationService.svc' does not exist.
       at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath)
       at System.ServiceModel.ServiceHostingEnvironment.EnsureServiceAvailableFast(String relativeVirtualPath)
       at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandleRequest()
       at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest()
       at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
       at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result)
     Process Name: w3wp
     Process ID: 6108

    Event Xml:
    <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
      <System>
        <Provider Name="System.ServiceModel 4.0.0.0" />
        <EventID Qualifiers="49154">3</EventID>
        <Level>2</Level>
        <Task>5</Task>
        <Keywords>0x80000000000000</Keywords>
        <TimeCreated SystemTime="2010-08-09T11:10:20.000000000Z" />
        <EventRecordID>8636</EventRecordID>
        <Channel>Application</Channel>
        <Computer>MyPC.MyCompany.local</Computer>
        <Security UserID="S-1-5-18" />
      </System>
      <EventData>
        <Data>System.ServiceModel.Activation.HostedHttpRequestAsyncResult/35230616</Data>
        <Data>System.Web.HttpException (0x80004005): The service '/ClientBin/MyApp-Web-AuthenticationService.svc' does not exist. ---&gt; System.ServiceModel.EndpointNotFoundException: The service '/ClientBin/MyApp-Web-AuthenticationService.svc' does not exist.
       at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath)
       at System.ServiceModel.ServiceHostingEnvironment.EnsureServiceAvailableFast(String relativeVirtualPath)
       at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandleRequest()
       at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest()
       at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
       at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result)</Data>
        <Data>w3wp</Data>
        <Data>6108</Data>
      </EventData>
    </Event>


    Monday, August 09, 2010 7:36 AM
  • Is your SVC really in the ClientBin directory?  I would expect it to be in the root of your virtual directory.  Not sure why it is referencing ClientBin for that.

    Monday, August 09, 2010 8:08 AM
  • With or without the ClientBin folder, I get the same result.  I did see a response on another forum saying that the ClientBin folder doesn't seem to make any difference.  When its working it works with both Undecided


    Edit:  The MyApp.xap file is in the ClientBin folder which may explain why it looks in there for it.

    Monday, August 09, 2010 8:13 AM
  • Here is the error being returned:

    at System.ServiceModel.DomainServices.Client.OperationBase.Complete(Exception error)
       at System.ServiceModel.DomainServices.Client.ApplicationServices.AuthenticationOperation.End(IAsyncResult result)
       at System.ServiceModel.DomainServices.Client.ApplicationServices.AuthenticationOperation.<>c__DisplayClass1.<HandleAsyncCompleted>b__0(Object state)
       at System.ServiceModel.DomainServices.Client.ApplicationServices.AuthenticationOperation.RunInSynchronizationContext(SendOrPostCallback callback, Object state)
       at System.ServiceModel.DomainServices.Client.ApplicationServices.AuthenticationOperation.HandleAsyncCompleted(IAsyncResult asyncResult)
       at System.ServiceModel.DomainServices.Client.AsyncResultBase.Complete()
       at System.ServiceModel.DomainServices.Client.ApplicationServices.WebAuthenticationService.HandleOperationComplete(OperationBase operation)
       at System.ServiceModel.DomainServices.Client.LoadOperation.<>c__DisplayClass4`1.<Create>b__0(LoadOperation`1 arg)
       at System.ServiceModel.DomainServices.Client.LoadOperation`1.InvokeCompleteAction()
       at System.ServiceModel.DomainServices.Client.OperationBase.Complete(Exception error)
       at System.ServiceModel.DomainServices.Client.LoadOperation.Complete(Exception error)
       at System.ServiceModel.DomainServices.Client.DomainContext.CompleteLoad(IAsyncResult asyncResult)
       at System.ServiceModel.DomainServices.Client.DomainContext.<>c__DisplayClass1b.<Load>b__17(Object )
    Caused by: Load operation failed for query 'GetUser'. The remote server returned an error: NotFound.

    Monday, August 09, 2010 9:48 AM
  • I'm afraid I've lost all my hair with this issue.  Looking through the web, it looks like it's a very common problem.  Surely someone has either solved it or Microsoft have got around to looking into fixing it?


    Basically, when you deploy the Silverlight Business Template onto IIS7, it doesn't work.  That's very poor in my opinion.

    Tuesday, August 10, 2010 5:32 AM
  • I've uninstalled IIS7.5 and reinstalled:


    Application Server

    IIS7.5

    .NET 3.5 + http bindings


    then ran the ServiceModelReg.exe -i and aspnet_regiis -ia command to install the WCF bits.  Then I installed:

    .NET 4.0

    RIA Services as Server

    then ran ServiceModelReg.exe -i and aspnet_regiis -ia again.

    The configuration of IIS looks better now but I'm still getting the service not found.

    Aaaargh!

    Wednesday, August 11, 2010 6:13 AM
  • In a desperate attempt to see if I'm missing the obvious here, here's the Web.Config file:

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <configSections>
        <sectionGroup name="system.serviceModel">
          <section name="domainServices" type="System.ServiceModel.DomainServices.Hosting.DomainServicesSection, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" allowDefinition="MachineToApplication" requirePermission="false" />
        </sectionGroup>
      </configSections>
      <system.web>
        <authentication mode="Windows" />
        <authorization>
        </authorization>
        <siteMap defaultProvider="XmlSiteMapProvider" enabled="true">
          <providers>
            <add name="XmlSiteMapProvider" description="Default SiteMap provider." type="System.Web.XmlSiteMapProvider" siteMapFile="Web.sitemap" securityTrimmingEnabled="true" />
          </providers>
        </siteMap>
        <httpModules>
          <add name="DomainServiceModule" type="System.ServiceModel.DomainServices.Hosting.DomainServiceHttpModule, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        </httpModules>
        <roleManager enabled="true" />
        <identity impersonate="false" />
        <profile>
          <properties>
            <add name="FriendlyName" />
          </properties>
        </profile>
        <customErrors mode="Off" />
        <compilation debug="true" defaultLanguage="c#" targetFramework="4.0">
          <assemblies>
            <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
          </assemblies>
        </compilation>
      </system.web>
      <system.webServer>
        <validation validateIntegratedModeConfiguration="false" />
        <modules runAllManagedModulesForAllRequests="true">
          <add name="DomainServiceModule" preCondition="managedHandler" type="System.ServiceModel.DomainServices.Hosting.DomainServiceHttpModule, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        </modules>
        <defaultDocument>
          <files>
            <clear />
            <add value="default.aspx" />
          </files>
        </defaultDocument>
      </system.webServer>
      <system.serviceModel>
        <domainServices>
          <endpoints>
            <add name="OData" type="System.ServiceModel.DomainServices.Hosting.ODataEndpointFactory, System.ServiceModel.DomainServices.Hosting.OData, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
          </endpoints>
        </domainServices>
        <behaviors>
          <serviceBehaviors>
            <behavior name="">
              <serviceMetadata httpGetEnabled="true" />
              <serviceDebug includeExceptionDetailInFaults="false" />
            </behavior>
          </serviceBehaviors>
        </behaviors>
        <bindings>
          <customBinding>
            <binding name="MyApp.Web.Services.DataService.customBinding0">
              <binaryMessageEncoding />
              <httpTransport authenticationScheme="Negotiate" />
            </binding>
          </customBinding>
        </bindings>
        <services>
          <service name="MyApp.Web.Services.DataService">
            <endpoint address="" binding="customBinding" bindingConfiguration="MyApp.Web.Services.DataService.customBinding0"
              contract="MyApp.Web.Services.DataService" />
          </service>
        </services>
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true"
          multipleSiteBindingsEnabled="false">
          <baseAddressPrefixFilters>
            <add prefix="http://localhost/" />
          </baseAddressPrefixFilters>
        </serviceHostingEnvironment>
      </system.serviceModel>
      <connectionStrings>
        <remove name="MySqlServer" />
        <add name="MySqlServer" connectionString="MyConnectionString" providerName="System.Data.SqlClient" />
        <remove name="LocalSqlServer" />
        <add name="LocalSqlServer" connectionString="AnotherConnectionString;Initial Catalog=aspnetdb" providerName="System.Data.SqlClient" />
        <add name="SilverwingMercuryEntities" connectionString="metadata=res://*/MyDataModel.csdl|res://*/MyDataModel.ssdl|res://*/MyDataModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;MyConnectionString&quot;" providerName="System.Data.EntityClient" />
      </connectionStrings>
      <system.net>
        <mailSettings>
          <smtp>
            <network host="MyExchangeServer" port="587" userName="Admin@MySite.com" password="MyPassword" />
          </smtp>
        </mailSettings>
      </system.net>
    </configuration>

    Wednesday, August 11, 2010 6:49 AM
  • Please use Fiddler to get the request details and share the abnormal items.

    Friday, August 13, 2010 3:23 AM
  • Most of the time I've found this is a missing reference.

    Assuming everything works fine when debugging:

    1. Build your project; take note of the files placed in \bin.

    2. Deploy your project.

    3. Compare the \bin folder between your debug build (which is working) and the deployment \bin folder (not working).

    4. Copy over any missing files.

    Thursday, April 05, 2012 3:15 PM
  • Use my troubleshooting script here

    http://www.redmountainsw.com/wordpress/2010/07/05/sl4-wcf-problem/

    Also turn off Windows authentication on your IIS

    Wednesday, April 11, 2012 7:07 PM