简体   繁体   English

Process.Start无法使用UAT打开文件

[英]Process.Start not working on UAT for opening file

this works on dev as usual when I put it on UAT the code does something different. 当我将其放在UAT上时,此代码可以像往常一样在dev上运行,代码有一些不同之处。 A PDF is saved on the server, the class then opens it up using the url of that file. PDF将保存在服务器上,然后该类使用该文件的URL将其打开。 The URL works fine if I paste it into a browser, but doesn't work from the code. 如果将URL粘贴到浏览器中,则该URL可以正常工作,但无法从代码中使用。 Here's my code: 这是我的代码:

  Process.Start(openPath);

openPath will look like: "http://www.cbm360.net/test/temp/CBM360Report_1093750.pdf" openPath如下所示:“ http://www.cbm360.net/test/temp/CBM360Report_1093750.pdf”

The file is there on the server, but it just won't open in the code. 该文件位于服务器上,但不会在代码中打开。 The code is inside a web method called using AJAX, if that makes any difference, I'm not sure. 该代码位于使用AJAX调用的Web方法内部,如果不确定,我不确定。

Does anyone have any suggestions as to why this isn't working? 有谁对为什么这个不起作用有任何建议吗?

The Exception is: 例外是:

 System.ComponentModel.Win32Exception: The system cannot find the file specified

Thanks! 谢谢!

Instead of pasting the URL into a browser (I assume this is on the server), try it directly from the command line on the server. 与其将URL粘贴到浏览器中(我假设这是在服务器上),不如直接在服务器上的命令行中尝试它。 Does it work now? 现在可以用吗? Process.Start is not the same as navigating to a URL in the browser, it is more akin to running the URL from the command line. Process.Start与在浏览器中导航到URL不同,它更类似于从命令行运行URL。 I am not sure what you are trying to achieve. 我不确定您要达到什么目标。 Normally we would use a web request to get a pdf. 通常,我们会使用网络请求获取pdf。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM