locked
cannot create service reference to localhost:port RRS feed

  • Question

  • I also entered this post as a bug but hopefully it is an envrionment problem so I am also posting it here 

    Windows Server 2003 (IIS 6)
    Visual Studio 2008
    .NET FrameWork 3.5 SP1 
    Project type = "Silverlight Navigation Application", "APS.NET Web Site" (not a Web Application Projet)
    Created a service.cs on the .Web side of the application. 
    Created a reference to that service.cs on the Silverlight side.
    For a time all is good as I can referenc the service as localhost:port (e.g. localhost:1374) in Visual Studio and debug both Silverlight side and service.cs
    To access the application in production mode (from IE) I update the service refrence and replace localhost:port with the IP address.
    The problem with the IP address is I cannot debug the service.cs so I have to change it back to localhost:port to debug.
    Now to the problem.
    After a period of time localhost:port just plain breaks. 
    I get an error message no service at the other end.
    Yes I know the port can change - that is not the problem - the port on the service side just plain breaks.
    For example from Visual Studio from the Silverlight side of the project right click "Service Reference", "Add Service Reverence".
    It finds 1 service in the application on a port.
    But when I click that service under "Services:" in the modal dialog box "Add Service Reference" I get an error: 
       There was an error downloading 'http://localhost:1377/SehaleCSS.Web/Service.svc'.  
       The request failed with the error message:
       --
      <html>
          <head>
              <title>Could not load file or assembly 'App_Web_tipnndfq, 
    If I go back to the IP address the service is repsponding (with the right answer) 
    The service just plain goes a while responding to localhost:port and then fails
    Even making NO change to service.cs it go a while then fails as a localhost:port
    It is not IIS environmental as I can go back to a prior saved version of the code and it works
    Something is happening that the .web side of the application is failing. 
    It still works as an IP and it still exposes itself as a localhost:port but it fails to properly repsonde as a localhost:port. 
    Silverlight is cool and I love XAML but my job is delivering production web sites and Silverlight fails at a production level (this is my third major problem taking silverlight from the lab to production) and I need this job. 

     If I test using WcfTestClient.exe the IP address repsondes but localhost:port does not.

    Below is the services section from the web.config of the service side
    I tried replacing customBinding with httpBasic and that broke the service even as an IP

    <
    service behaviorConfiguration="ServiceBehavior" name="Service">
      <
    endpoint address="" binding="customBinding" bindingConfiguration="customBinding0" contract="Service" />
      <
    endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
    </
    service>
      <
    service name="Service2">
      <
    endpoint address="" behaviorConfiguration="Service2AspNetAjaxBehavior" binding="webHttpBinding" contract="Service2" />
    </
    service>

    Appears the service is not starting as a port.

    Wednesday, February 24, 2010 11:08 AM

Answers

  • Thanks,
    Pretty sure it was a bug in ASP.NET.
    Found where others were having the same problem.
     
    The service on the port would not produce a WSDL.
    IIS would responde as it is not port based. 
    (but could not debug across domains)

    Installing ASP.NET 2.0 Service Pack 2.0 appeares to have fixed the problem.
    Thanks for the info on how to attach a debugger and the name of .exe to attach to

    Thursday, February 25, 2010 1:21 PM

All replies

  • Learned more. 
    If I leave the port off and just add a service refence to localhost (http://localhost/SehaleCSS.Web/Service.svc) I do get the reference.  
    But I have the same problem I have with the IP address - canNOT dedug the service.cs.  
    At this time the client is using port 2034 (get that from Application.Current.Host.Source).
    But canNOT connect to EndPointAddress localhost:2034.
    Can connet to localhost or IP address.
    What I suspect is the Service is up and listening on localhost but it is listening on a different port. 
    Again the problem is cannot debug the service.cs.
    I used to be able to debug the service.cs by setting the Service Reference to localhost:port but now I canNOT set the Service Reference to localhost:port.

     

    Wednesday, February 24, 2010 12:53 PM
  • This might help you to understand the problem. It's a cross-domain issue when you use "http://localhost/SehaleCSS.Web/Service.svc" to call your service.

    http://forums.silverlight.net/forums/p/24005/86700.aspx

    If you need to debug the code running under IIS. Do you use f5. Use Attach to Process feature to Attach to the process you need to debug. Goto your browser to enter your Page URL (without the port number) to load the page. To debug the Silverlight code, attach to the IE instance that running your page, to debug the Service code, attach to the w3wp.exe.

     

     

     

     

     

    Wednesday, February 24, 2010 1:18 PM
  • Thanks,
    Pretty sure it was a bug in ASP.NET.
    Found where others were having the same problem.
     
    The service on the port would not produce a WSDL.
    IIS would responde as it is not port based. 
    (but could not debug across domains)

    Installing ASP.NET 2.0 Service Pack 2.0 appeares to have fixed the problem.
    Thanks for the info on how to attach a debugger and the name of .exe to attach to

    Thursday, February 25, 2010 1:21 PM