"访问被拒绝"构建服务器上使用XML文档部署Web API项目时 [英] "Access is denied" on build server when deploying Web API project with XML documentation

查看:341
本文介绍了"访问被拒绝"构建服务器上使用XML文档部署Web API项目时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了使用Web API帮助页面我的Web API项目生成XML文档,我不得不检查下的构建我的项目属性的部分XML文档文件选项。当我建立本地本正确生成的文档。

In order to generate XML documentation using Web API Help Pages for my Web API project, I had to check the "XML documentation file" option under the "Builds" section of my project's properties. This correctly generates the documentation when I build locally.

然而,当我检查,我得到的生成服务器上出现以下错误:

However, when I check in, I get the following error on the build server:

CSC:错误生成XML文档文件
  C:\\构建\\ 3 \\来源\\ CURRENTVERSION \\项目名\\程序App_Data \\ XmlDocument.xml
  (访问被拒绝。')

CSC: Error generating XML documentation file 'c:\Builds\3...\Sources\CurrentVersion...\ProjectName\App_Data\XmlDocument.xml' ('Access is denied. ')

我不知道为什么会这样,因为它会为每个反正打造一个新的目录。我用Google搜索这个问题,并搜查堆栈溢出,但我发现的唯一解决办法是删除该XML文档文件(这违背了使用的Web API帮助页面的目的)。我怎样才能解决这个问题?

I'm not sure why this happens, since it creates a new directory for each build anyway. I googled this issue and searched Stack Overflow, but the only solutions I found were to remove the XML documentation file (which defeats the purpose of using Web API Help Pages). How can I resolve this?

推荐答案

如果XML文件签入到TFS那么当TFS获取文件到构建服务器上的工作区,将有只读属性与该文件相关联。现在,当编译生成新的XML文件,它不会是能够覆盖旧的XML文件,因为它具有只读属性。

If the XML file is checked-in to TFS then when TFS gets the files to the workspace on the build server, it will have "Read-Only attribute" associated with the file. Now when the build generates the new XML file, it wont be able to overwrite the old XML file since it has the read-only attribute.

解决方法是:
A)使用你的构建脚本修改文件属性,使其读写
b)将签入到TFS使XML文件,构建就能方便地生成XML。

Solution is to: a) use your build scripts to modify the file attribute and make it read-write b) remove the xml file checked-in to TFS so that, build will be able to generate the XML easily.

更新:如果你正在使用的解决方案B,如果该文件是你的一部分项目文件,确保您从文件的csproj删除文件以及

Update: if you are using solution b, if the file is part of you project file make sure that you remove the file from the csproj file as well.

这篇关于"访问被拒绝"构建服务器上使用XML文档部署Web API项目时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆