Click here to Skip to main content
15,892,643 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
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.
HTML
Error is : The underlying connection was closed: The connection was closed unexpectedly.

this is my 3 file...

Iservice1.cs
XML
[OperationContract]
        List<Vehicle_Master> GetVehicle();

Service1.svc.cs
XML
public List<Vehicle_Master> GetVehicle()
        {
            //Configuration.ProxyCreationEnabled = false;
            var result = (from var in dcdc.Vehicle_Masters select var).ToList();
            return result.ToList();
        }

Web.config
HTML
<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
Updated 5-Oct-12 19:08pm
v3

1 solution

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 )
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900