Click here to Skip to main content
15,896,606 members

The underlying connection was closed: The connection was closed unexpectedly in wcf service.

najar palsaniya asked:

Open original thread
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..
Tags: WCF

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



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