I get this error Error: The remote server returned an error: 227 Entering Passive Mode (52,157,171,40,242,234)

Tony Johansson 40 Reputation points
2023-06-27T09:49:40.1866667+00:00

Hello,

I have written a C#.net program that transfer an xml file to a remote azure virtualmachine(VM). When I get this error from Stream requestStream = request.GetRequestStream()

I retry until it succeeds. When I get the error I have to retry one two or three times until it works.

Here is a sceenshot how it could look like.User's image

I have tried with chatgpt but it isn't anything with firewall and such thing because it works most of the times even if I have to make some retries. I can always send the file even if I have to make some retries. I have google a lot and tried to find anything useful to solve my problem but haven't find anything.

If I look at the log when it works it says

User's image

Here is the log when I get an error

User's image

So as you can see from the log when this line is written to the log <Date/Time> Info [Type] Message <27-06-2023 10:57:33> FTP Session 652 185.176.247.175 idre [Response] 227 Entering Passive Mode (52,157,171,40,237,122)

I get this line when it works <Date/Time> Info [Type] Message <27-06-2023 11:06:20> FTP Session 653 185.176.247.175 idre [Command] STOR a6109523-a23b-47ed-9732-40ea4535c82f.xml

I get this line when it doesn't work. <Date/Time> Info [Type] Message <27-06-2023 11:10:41> FTP Server [Status] Session 660 ended gracefully.

I do hope that someone can guide me in the right direction to solve this problem because I have run out of ideas because it do works but I have to retry a couple of times.

Many thanks in advance Tony

Developer technologies | .NET | Other
Developer technologies | C#
Developer technologies | C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
{count} votes

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.