上周末从TFS 2018 v3更新到DevOps Server 2019.0.1之后,现在尝试管理安全性时会收到此身份验证错误:
def constant(a,b):
def pair(f):
return(f(a,b))
return pair
a = constant(1,2) #If You Print variable-> a then it will display "<function constant.
#<locals>.pair at 0x02EC94B0>"
pair(lambda a, b: a) #This will return variable a.
当尝试通过“应用程序层”>“管理安全性”从服务器管理控制台管理安全性时,收到此错误。当我尝试通过tfssecurity cli工具设置权限时,也会收到错误消息。我在本地管理员组中,并且在控制台管理用户部分中列出。
我正在尝试设置权限,因为在更新之后,我收到了一些来自员工的报告,这些报告在尝试访问其项目时收到错误。这些错误是:
@RestController // It is also possible to @Controller.
public class StreamingResponseController {
@RequestMapping(value = "/", method = RequestMethod.GET)
public void getSteamingFile(HttpServletResponse response) throws Exception {
//File f = new File("C:\\Users\\guido\\Download\\t1.csv"); trying to download the file just if the files doesn't exist
boolean b = true;
if(b/*f.exists() && !f.isDirectory()*/){ //if condition that doesn't work, so I had to add a boolean
response.setContentType("text/csv");
response.setHeader("Content-Disposition", "attachment; filename=\"t1.csv\"");
try {
URLConnection openConnection = new URL("https://www.dati.gov.it/api/3/action/package_show?id=537c1138-4c5f-41bb-aec8-862954b67b28").openConnection();
openConnection.addRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0");
InputStream in = openConnection.getInputStream();
String data = "";
String line = "";
try {
InputStreamReader inR = new InputStreamReader( in );
BufferedReader buf = new BufferedReader( inR );
while ( ( line = buf.readLine() ) != null ) {
data+= line;
System.out.println( line );
}
} finally {
in.close();
}
JSONObject obj = (JSONObject) JSONValue.parseWithException(data);
JSONObject objI = (JSONObject) (obj.get("result"));
JSONArray objA = (JSONArray) (objI.get("resources"));
for(Object o: objA){
if ( o instanceof JSONObject ) {
JSONObject o1 = (JSONObject)o;
String format = (String)o1.get("format");
String urlD = (String)o1.get("url");
System.out.println(format + " | " + urlD);
if(format.equals("csv")) {
download(urlD, "t1.csv");
}
}
}
System.out.println( "OK" );
} catch (Exception e) {
e.printStackTrace();
}
}
}
public static void download(String url, String fileName) {
try {
/* attempt that works, but I tried other ways
* InputStream in = URI.create(url).toURL().openStream();
* System.out.println("attempt error");
* Files.copy(in, Paths.get(fileName));
* System.out.println("attempt error 2");
in.close();*/
BufferedInputStream inputStream = new BufferedInputStream(new URL(url).openStream());
FileOutputStream fileOS = new FileOutputStream("t1-prova.csv");
byte data[] = new byte[1024];
int byteContent;
while ((byteContent = inputStream.read(data, 0, 1024)) != -1) {
fileOS.write(data, 0, byteContent);
}
fileOS.close();
inputStream.close();
} catch (IOException e) {
System.out.println("ciao");
}
}}
答案 0 :(得分:0)
昨天我花了8个小时来解决此问题,而这正是解决我们问题的原因:
已删除DevOps服务器缓存。 (服务器上devops管理控制台中列出的缓存位置)
重新启动服务器。
我根据我读到的文章(存在相同错误)删除了服务器上的缓存,用户遇到了Visual Studio的安全性/权限问题,并且他们删除了本地计算机上的vs缓存并解决了他们的问题。我不知道删除缓存或重新启动是否可以单独修复它,因为我将它们都作为一个故障排除步骤来完成的。
希望这对某人有帮助。