• Register
0 votes

Problem :

I am trying to use the WCF4.0 template -REST. Also I am trying to make the method that uploads a file using the stream.

The problem always occur at below line of code:

Stream myserverStream = myrequest.GetRequestStream();

My Class for streaming as below:

namespace LogicClass


    public class MyStreamClass : IStreamClass


        public bool MyUploadFile(string myfilename, Stream myfileStream)




               FileStream myfileToupload = new FileStream(myfilename, FileMode.Create);

                byte[] mybytearray = new byte[10000];

                int mybytesRead, mytotalBytesRead = 0;



                mybytesRead = myfileStream.Read(mybytearray, 0, mybytearray.Length);

                    mytotalBytesRead += mybytesRead;

                } while (mybytesRead > 0);

              myfileToupload.Write(mybytearray, 0, mybytearray.Length);




            catch (Exception myex) { throw new Exception(myex.Message); }

            return true;




My REST project as below:

[WebInvoke(UriTemplate = "AddStream/{filename}", Method = "POST", BodyStyle = WebMessageBodyStyle.Bare)]

public bool AddStream(string myfilename, System.IO.Stream myfileStream)


    LogicClass.FileComponent myrest = new LogicClass.FileComponent();

    return myrest.AddStream(myfilename, myfileStream);



I have already turned off the firewall and my Internet connection, however the error still exists. Can anyone suggest a better way of testing the uploading method?

My Stack trace as below:

at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)

6 5 3
7,540 points

1 Answer

0 votes

Solution :

Here you do not have to restart your PC. Restart the IIS instead.

Run -> 'cmd'(as admin) and type "iisreset"

 Your issue will be resolved.

9 7 4
38,600 points

Related questions

0 votes
0 answers 4 views
7 I have a problem with these client and server codes, I keep getting the [Errno 10061] No connection could be made because the target machine actively refused it I'm running the server on a virtual machine with Windows XP SP3 and the client on Windows 7 64bit, my python version is ... msg) msg = s.recv(1024) print 'SERVER >> ', msg #s.close # Close the socket when done PS : code is from internet.
asked 2 days ago psandprop 2.2k points
0 votes
1 answer 2K views
Problem : I am facing the issue with the client and server codes, I keep on getting the [Errno 10061] No connection could be made because the target machine actively refused it I am running the server on a VM with Windows XP SP3 and my client is on Windows 7 64bit, also my python ... ('CLIENT >> ') s.send(msg) msg = s.recv(1024) print 'SERVER >> ', msg #s.close # Close the socket when done
asked Nov 21, 2019 peterlaw 6.9k points
1 vote
1 answer 10 views
Problem: I am having fundamental knowledge on C#. Currently I am unable to connect to the HTTPS server with the use of WebRequest as I am facing below error message: "The request was aborted: Could not create SSL/TLS secure channel." I understand that my ... my server never really validates a certificate and it fails with a above error. Kindly guide me in fixing above certificate related error.
asked Jun 30 Raphael Pacheco 4.9k points
1 vote
1 answer 261 views
Problem : Facing bellow error the server committed a protocol violation. section=responseheader detail=cr must be followed by lf
asked Nov 8, 2019 peterlaw 6.9k points