路径不';t指向有效的Git存储库或workdir

路径不';t指向有效的Git存储库或workdir,git,web-services,libgit2sharp,Git,Web Services,Libgit2sharp,刚开始“玩”LibGit2Sharp,我在从本地存储库访问分支列表时遇到了问题。 目标是从我的Web服务访问Git(现在只是为了获得分支列表) [WebMethod] public string GetStringOfBranches() { string gitPath = @"C:\Users\MyUser\Documents\MyRepository"; using (var repo = new Repository(gitPath))

刚开始“玩”LibGit2Sharp,我在从本地存储库访问分支列表时遇到了问题。 目标是从我的Web服务访问Git(现在只是为了获得分支列表)

[WebMethod]
    public string GetStringOfBranches()
    {
        string gitPath = @"C:\Users\MyUser\Documents\MyRepository";
        using (var repo = new Repository(gitPath))
        {

            //Console.WriteLine("start");
            foreach (var branch in repo.Branches)
            {
                Console.WriteLine(branch.FriendlyName);

            }

        }
}
如果我在调试模式下运行项目,或者从测试项目运行项目,那么它可以正常工作。 如果我发布到IIS。。。游戏结束后,出现错误“LibGit2Sharp.RepositoryNotFoundException:路径'C:\Users\MyUser\Documents\MyRepository'未指向有效的Git存储库或workdir”。 在LibGit2Sharp.Core.Proxy.git\u存储库中打开(字符串路径) 在LibGit2Sharp.Repository..ctor(字符串路径、RepositoryOptions选项、RepositoryRequiredParameter requiredParameter)
在C:\Users\MyUser\Documents\Visual Studio 2017\Projects\WebSrv3\WebSrv3\MyWs.asmx.cs中的WebSrv3.wsGitInterface.GetStringOfBranches()处:第58行“

运行IIS的服务器上是否存在存储库?如果是这样,IIS是否有权限访问存储库目录?谢谢你重定向我的眼睛!!!存储库位于服务器上,但IIS没有权限,但现在它已经并正在工作!!!!请参考答案