gpt4 book ai didi

wcf - 如何获取wcf应用程序的工作路径?

转载 作者:行者123 更新时间:2023-12-03 05:27:59 26 4
gpt4 key购买 nike

我想要获取 WCF 应用程序的工作文件夹。我怎么才能得到它?

如果我尝试

HttpContext.Current.Request.MapPath(HttpContext.Current.Request.ApplicationPath)

我收到空引用异常(Http.Current 对象为空)。

<小时/>

我所说的工作文件夹是指运行 WCF 服务的文件夹。如果我设置 aspNetCompatibilityEnabled="true",我会收到此错误:

The server did not provide a meaningful reply; this might be caused by a contract mismatch, a premature session shutdown or an internal server error.

最佳答案

我的 IIS6 托管 WCF 应用程序需要相同的信息,我发现这对我有用:

string apPath = System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath;

一如既往,YMMV。

关于wcf - 如何获取wcf应用程序的工作路径?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/791468/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com