【发布时间】:2020-05-15 11:30:18
【问题描述】:
New error好的,所以我遇到了一个错误,我不知道如何解决它,我们很乐意提供任何帮助。它在 WPF 2019 视觉工作室中。这是一个 .cs 程序 [program.cs]
at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
at System.Uri..ctor(String uriString)
at Bootstrapper.Program.Main(String[] args) in C:\Users\raduf\Desktop\Exploit Template\Bootstrapper\Program.cs:line 40
System.UriFormatException: '无效的 URI:无法确定 URI 的格式。' System.UriFormatException HResult=0x80131537 Message=无效的 URI:无法确定 URI 的格式。此异常最初是在此调用堆栈中引发的:Program.cs 中的 [External Code] Bootstrapper.Program.Main(string[])
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Net;
using System.Diagnostics;
namespace Bootstrapper
{
class Program
{
static String[] files = new string[]
{
"https://emaciated-blower.000webhostapp.com/Sploit/MeguSploit/",
};
static void Main(string[] args)
{
if (!Directory.Exists(Environment.CurrentDirectory + "/Exploit"))
{
Directory.CreateDirectory(Environment.CurrentDirectory + "/Exploit");
}
Console.Title = "MeguSploit Bootstrapper";
Console.WriteLine("Updating....");
foreach (Process process in Process.GetProcessesByName("MeguSploit"))
{
process.Kill();
}
foreach (string file in files)
{
string name = file.Substring(file.LastIndexOf("/") + 1);
try
{
new WebClient().DownloadFile(new Uri(file), Environment.CurrentDirectory + "/Exploit/" + name);
}
catch (IOException ex) //HERE
{
}
}
Console.WriteLine("Updated...");
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("Please go to exploit folder and run the program. Make sure to always ru the bootstrapper to check for updates.");
Console.ForegroundColor = ConsoleColor.White;
Console.WriteLine("Press any key to close...");
Console.ReadKey();
Environment.Exit(0);
Console.Read();
}
}
}
抱歉我的代码不好,我是这个世界的新手。我试图让它工作几个小时,但我做不到。 再次感谢。
【问题讨论】:
-
错误是什么?
-
System.UriFormatException: '无效的 URI:无法确定 URI 的格式。' System.UriFormatException HResult=0x80131537 Message=无效的 URI:无法确定 URI 的格式。此异常最初是在此调用堆栈中引发的:Program.cs 中的 [External Code] Bootstrapper.Program.Main(string[])
-
你有没有调试过你的代码来查看
file和name等的运行时值?在我看来,您的files数组似乎没有文件的 URI。 -
是的,你去:ibb.co/WDzWd6H
-
file的值是“dll”,这显然不是 URI。向后追溯以找出原因。
标签: c# .net wpf visual-studio