This could be due to the service endpoint binding not using the HTTP protocol

前端 未结 22 2142
梦谈多话
梦谈多话 2020-12-22 23:10

I have a WCF Service running fine on my local machine. I put it on the servers, and I am receiving the following error:

An error occurred while receiv

相关标签:
22条回答
  • 2020-12-23 00:08

    Solution with DataContract, Flags for Enums looks a bit ugly. In my case problem been solved by adding something like "NotSet = 0" into enum:

    public enum Fruits
    {
      UNKNOWN = 0,
      APPLE = 1,
      BALL = 2,
      ORANGE = 3 
    }
    
    0 讨论(0)
  • 2020-12-23 00:08

    To fix this, we had to changed the AppPool Identity to an administrator account.

    0 讨论(0)
  • 2020-12-23 00:08

    For me the solutions of this Error very strange. It was the issue of port address of EndpointAddress. In Visual studio port address of your file (e.g. Service1.svc) and port address of your wcf project must be the same which you gives into EndpointAddress. Let me describe you this solution in detail.

    There are two steps to check the port addresses.

    1. In your WCF Project right click to your Service file (e.g. Service1.svc) -> than select View in browser now in your browser you have url like http://localhost:61122/Service1.svc so now note down your port address as a 61122

    2. Righ click your wcf project -> than select Properties -> go to the Web Tab -> Now in Servers section -> select Use Visual Studio Development Server -> select Specific Port and give the port address which we have earlier find from our Service1.svc service. That is (61122).

    Earlier I have different port address. After Specifying port address properly which I have given into EndpointAddress, my problem was solved.

    I hope this might be solved your issue.

    0 讨论(0)
  • 2020-12-23 00:09

    For more insight into this issue, also see: An existing connection was forcibly closed by the remote host - WCF

    My problem ended up being that my data transfer objects were too complex. Start withsimple properties like public long Id { get; set; } and once you get that working than start adding additional stuff as needed.

    0 讨论(0)
  • 2020-12-23 00:10

    My problem was too many items were being passed between client and server. I had to change this settings in the behavior on both sides.

    <dataContractSerializer maxItemsInObjectGraph="2147483646"/>
    
    0 讨论(0)
  • 2020-12-23 00:11

    I think the best way to solve this is to follow the error advice, hence looking for server logs. To enable logs I added

     <system.diagnostics>
        <sources>
          <source name="System.ServiceModel" switchValue="Information, ActivityTracing" propagateActivity="true">
            <listeners>
              <add name="traceListener" type="System.Diagnostics.XmlWriterTraceListener" initializeData="c:\logs\TracesServ_ce.svclog" />
            </listeners>
          </source>
        </sources>
      </system.diagnostics>
    

    Then you go to c:\logs\TracesServ_ce.svclog open it with microsoft service trace viewer. And see what the problem really is.

    0 讨论(0)
提交回复
热议问题