Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: WCF
1.Failed to invoke the service. Possible causes: The service is offline or inaccessible; the client-side configuration does not match the proxy; the existing proxy is invalid. Refer to the stack trace for more detail. You can try to recover by starting a new proy, restoring to default configuration, or refreshing the service.
Error is : The underlying connection was closed: The connection was closed unexpectedly.
this is my 3 file...
 
Iservice1.cs
[OperationContract]
        List<Vehicle_Master> GetVehicle();
Service1.svc.cs
public List<Vehicle_Master> GetVehicle()
        {
            //Configuration.ProxyCreationEnabled = false;
            var result = (from var in dcdc.Vehicle_Masters select var).ToList();
            return result.ToList();
        }
Web.config
<configuration>
	
  <connectionstrings>
    <add name="Database1ConnectionString1" connectionstring="Data Source=najar-pc\sqlexpress;Initial Catalog=Database1;Integrated Security=True">
      providerName="System.Data.SqlClient" />
  </add></connectionstrings>
  <system.web>
    <compilation debug="true" targetframework="4.0" />
  </system.web>
  <system.servicemodel>
    <behaviors>
      <servicebehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <servicemetadata httpgetenabled="true" />
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <servicedebug includeexceptiondetailinfaults="false" />
        </behavior>
      </servicebehaviors>
    </behaviors>
    <servicehostingenvironment multiplesitebindingsenabled="true" />
  </system.servicemodel>
 <system.webserver>
    <modules runallmanagedmodulesforallrequests="true" />
  </system.webserver>
  
</configuration>
I have spend so much time but i have not solve it. please help me..
Posted 5-Oct-12 19:03pm
Edited 5-Oct-12 19:08pm
v3

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Its always a good idea to return your collection as an Array rather a lit from WCF .
 
Please check the following in your applicaiton
 
--> Your object has some some uninitialised object internally and its not getting serialized.
--> Convert signature from List to Array (always a good idea to avoid dirty serialization issues )
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 405
1 Sergey Alexandrovich Kryukov 220
2 Peter Leow 215
3 Maciej Los 195
4 DamithSL 174


Advertise | Privacy | Mobile
Web02 | 2.8.140709.1 | Last Updated 6 Oct 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid