Network path not found error for local machine

I am testing an application on my local machine to generate a file. The network path I set up for testing \\127.0.0.1\NEWFILE\test1.txt

. I am getting a "network path not found" error. What could be the problem?

filePath = @"\\127.0.0.1\NEWFILE\test1.txt";
File.WriteAllText(filePath, Contents.ToString());

      

+2


source to share


4 answers


Try

filePath = @"\\127.0.0.1\NEWFILE\test1.txt";
File.WriteAllText(filePath, Contents.ToString());

      

Notice the extra backslash.



EDIT 1
Is NEWFILE a fraction on your computer that your program has write access to?

EDIT 2
Confirm NEWFILE is a share on your computer. Open Windows Explorer and in the address bar \\ 127.0.0.1 \

After entering the last backslash, a list of available beats should appear. If NEWFILE is not one of them, then your problem.

0


source


You may need to add another forward slash. Server name UNC paths start with two abbreviations:



@"\\127.0.0.1\NEWFILE\..."

      

0


source


Make sure the NEWFILE share is configured correctly:

This should work, but there will be a "test1.txt" file in the NEWFILE share, not the newfile folder on C: \.

filePath = @"\\127.0.0.1\NEWFILE\test1.txt";

      

0


source


Check if Server Services is enabled , which supports file sharing, printing, and pipe sharing name over the network. You can find this service under Administration / Services. I had a similar problem. When adding user accounts to the local computer.

-1


source







All Articles