Directory.SetCurrentDirectory()不支持URI格式器

我正在处理一个旧项目,并且通过调试和重新设计,我偶然发现了以下错误。

文档将发送到位置http://localhost:8080/Files

在现有应用程序中,其处理方式是

1 var path = Export.Path; <- in Debug it is `http://localhost:8080/Files`
2 Directory.SetCurrentDirectory(path);

在第2行,抛出以下异常:

System.ArgumentException
  HResult=-2147024809
  Message=URI-Formate not supported.
  Source=mscorlib
  StackTrace:
       in System.IO.Path.LegacyNormalizePath(String path,Boolean fullCheck,Int32 maxPathLength,Boolean expandShortPaths)
       in System.IO.Path.NormalizePath(String path,Boolean expandShortPaths)
       in System.IO.Path.GetFullPathInternal(String path)
       in System.IO.Directory.SetCurrentDirectory(String path)
       in Controller.cs:Line 125.
       in lambda_method(Closure,Object,Object[] )
       in system.web.Http.Controllers.ReflectedHttpactionDescriptor.actionExecutor.<>c__DisplayClass13.<GetExecutor>b__c(Object instance,Object[] methodParameters)
       in system.web.Http.Controllers.ReflectedHttpactionDescriptor.actionExecutor.Execute(Object instance,Object[] arguments)
       in system.web.Http.Controllers.ReflectedHttpactionDescriptor.<>c__DisplayClass5.<ExecuteAsync>b__4()
       in System.Threading.Tasks.TaskHelpers.RunSynchronously[TResult](Func`1 func,CancellationToken cancellationToken)
  InnerException: 

该目录存在,我可以通过浏览器中的url行访问它。我搜索了多种解决方案,但没有找到适合我的问题。

zsdgr89456789000zzh7 回答:Directory.SetCurrentDirectory()不支持URI格式器

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3146442.html

大家都在问