I am trying to list a client with WCF and this error appears to me and I have seen that before many people have done it this way, maybe it is configuaración.
Error message:
[! [enter the description of the image here] [1]] [1]
And this is the code:
public List<Datos.cliente> listarClientesGeneral()
{
using (TallerRefuerzoEntities conexto = new TallerRefuerzoEntities())
{
return conexto.cliente.ToList();
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
namespace WcfHotel
{
[ServiceContract]
public interface IService1
{
[OperationContract]
List<Datos.cliente> listarClientesGeneral();
}
}
In the web.config I have this:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5.2" />
<httpRuntime targetFramework="4.5.2" />
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<directoryBrowse enabled="true" />
</system.webServer>
<connectionStrings>
<add name="TallerRefuerzoEntities" connectionString="metadata=res://*/Datos.Model1.csdl|res://*/Datos.Model1.ssdl|res://*/Datos.Model1.msl;provider=System.Data.SqlClient;provider connection string="data source=DORADO-PC;initial catalog=TallerRefuerzo;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
</connectionStrings>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="mssqllocaldb" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
</configuration>
This is my error when invoking in the wcf test client and in the bottom part I will place the error when uploading it to the iis, it may be useful:
The service could not be invoked. Possible causes: the service is offline or inaccessible. the client configuration does not match the proxy; The existing proxy is not valid. See the stack trace for more information. To try recovery, start a new proxy, restore the default settings or update the service.
Error receiving HTTP response to link . It may be because the service end link does not use the HTTP protocol. It may also be due to the server overriding an HTTP request context (possibly due to the closure of the service). Check server logs for more information.
Server stack trace: in System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException (WebException WebException, HttpWebRequest request, HttpAbortReason abortReason) in System.ServiceModel.Channels.HttpChannelFactory'1.HttpRequestChannel.HttpChannelRequest.WaitForReply (TimeSpan timeout) in System.ServiceModel.Channels.RequestChannel.Request (Message message, TimeSpan timeout) in System.ServiceModel.Dispatcher.RequestChannelBinder.Request (Message message, TimeSpan timeout) in System.ServiceModel.Channels.ServiceChannel.Call (String action, Boolean oneway, ProxyOperationRuntime operation, Object [] ins, Object [] outs, TimeSpan timeout) in System.ServiceModel.Channels.ServiceChannelProxy.InvokeService (IMethodCallMessage methodCall, ProxyOperationRuntime operation) in System.ServiceModel.Channels.ServiceChannelProxy.Invoke (IMessage message)
Exception rethrown at [0]: in System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage (IMessage reqMsg, IMessage retMsg) in System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke (MessageData & msgData, Int32 type) in IService1.List () in Service1Client.List ()
Inner Exception: The connection is terminated: Unexpected reception error. in System.Net.HttpWebRequest.GetResponse () in System.ServiceModel.Channels.HttpChannelFactory'1.HttpRequestChannel.HttpChannelRequest.WaitForReply (TimeSpan timeout)
Inner Exception: Unable to write data to the transport connection: The interruption of an existing connection by the remote host has been forced. in System.Net.Sockets.NetworkStream.Read (Byte [] buffer, Int32 offset, Int32 size) in System.Net.PooledStream.Read (Byte [] buffer, Int32 offset, Int32 size) in System.Net.Connection.SyncRead (HttpWebRequest request, Boolean userRetrievedStream, Boolean probeRead)
Inner Exception: The interruption of an existing connection has been forced by the remote host in System.Net.Sockets.Socket.Receive (Byte [] buffer, Int32 offset, Int32 size, SocketFlags socketFlags) in System.Net.Sockets.NetworkStream.Read (Byte [] buffer, Int32 offset, Int32 size)