部署c#项目 [英] Deploying an c# project

查看:76
本文介绍了部署c#项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI



我开发了一个C#应用程序,它使用Adobe Reader X(这是我的默认.pdf阅读器)动态创建并打开一个新创建的.pdf文件。



...



//创建文件

文件。 CreateFile(FileName);



//打开文件

System.Diagnostics.Process.Start(文件名);



...

//文件名是创建和存储.pdf文件的路径(这是我项目的调试文件夹)。



以上代码在Visual Studio 2010中完美运行,但在部署项目后却没有。

运行已安装的项目时,它既不会创建.pdf也不打开.pdf。



请帮助????

HI

I developed an C# application that dynamically creates and opens a newly created .pdf file using Adobe Reader X(Which is my default .pdf reader).

...

//Creating the file
Document.CreateFile(FileName);

//Opening the file
System.Diagnostics.Process.Start(Filename);

...
//File name is the path where the .pdf file is created and stored(Which is the debug folder of my project).

The above code works perfectly in Visual Studio 2010 but not once the project is deployed.
When running the installed project neither does it create the .pdf nor does it opens .pdf.

Please help ????

推荐答案

我们无法回答的问题 - 有太多方法可能会出现这样的问题。例如,目标计算机可能没有PDF文件的任何文件关联,这会阻止它们打开。我们无法分辨 - 你必须检查。



但是,最可能的问题是你将文件存储在错误的文件夹中。如果您尝试将它们保留在应用程序文件夹或应用程序文件夹中的文件夹中,则生产代码通常会失败,因为用户没有访问它所需的权限。 (忽略这是一个愚蠢的想法开始)它在开发中工作,因为您的应用程序在您的用户下运行,您可以访问您的应用程序文件夹(或者您无法编译新版本),但将其移至生产,并且你正在谈论Program Files / MyApp / xx.pdf而你还没有获得许可。



见这里:我应该在哪里存储我的数据? [ ^ ] - 它建议了一些安全的地方,并展示了如何使用它们。
We can't answer that - there are far too many ways that something like this could go wrong. For example, the target computer may not have any file association for PDF files which would prevent them opening. We can't tell - you will have to check.

However, the most likely problem is that you are storing the files in the wrong folder. If you try to keep them in the application folder, or a folder that is inside the application folder, then production code will generally fail as the user does not have the required permissions to access it. (ignoring that it's a silly idea to start with) It works in development, because your app is running under your user and you have access to your application folder (or you couldn't compile a new version) but move it to production, and your are talking about "Program Files/MyApp/xx.pdf" and you haven't got permission.

See here: Where should I store my data?[^] - it suggests some safe places, and shows how to use them.






我发现了我的问题。似乎我的程序或Windows 8存在兼容性问题,因为它在Windows 7上运行时没有预期,但在Windows 8上运行。



非常感谢你的时间,精力和帮助。
Hey

I found my problem. It appears that there is a compatibility issue with either my program or with Windows 8 because it runs as expected on Windows 7 but not Windows 8.

Thank you very much for your time, effort and help.


Quote:

System.Diagnostics.Process.Start(Filename) ;

System.Diagnostics.Process.Start(Filename);

此代码将在服务器上打开它。它不会在客户端打开它。在客户端上打开它的一种简单方法是使用Response.Redirect(url)或使用Response对象并将pdf流式传输到它。



你'很可能会出现权限问题。

This code will open it on the server. It will not open it on the client. An easy way to get it to open on the client is to use Response.Redirect(url) or use the Response object and stream the pdf to it.

You're likely getting a permissions issue.


这篇关于部署c#项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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