我无法在iis7上开设办公室 [英] i can't open office on iis7

查看:70
本文介绍了我无法在iis7上开设办公室的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨 我在IIS论坛中创建了帖子,但他们无法解决它

我在我的项目中在按钮中使用此代码:

Microsoft.Office.Interop.Word.Application WordApp =新的Microsoft.Office.Interop.Word.Application();

var path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments),"New" +".docx");

对象fileName =路径;
对象readOnly = false;
对象startIndex = 0;
对象isVisible = true;
对象丢失= System.Reflection.Missing.Value;

WordApp.Visible = true;

Microsoft.Office.Interop.Word.Document aDoc = WordApp.Documents.Add();

我在Visual Studio中单击按钮时将打开Word Office,但是当我在iis7上发布时,当我单击按钮时不要打开Word Office

请帮助我

解决方案

对于初学者来说,实际上不建议在Web服务器上进行办公室自动化.

http://support.microsoft.com/kb/257757 [ 尝试 { Microsoft.Office.Interop.Word.Application WordApp = Microsoft.Office.Interop.Word.Application(); var path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)," 新建" + .docx"); 对象 fileName =路径; 对象 readOnly = false ; 对象 startIndex = 0 ; 对象 isVisible = true ; 对象丢失= System.Reflection.Missing.Value; // 为什么使应用程序在服务器上可见? WordApp.Visible = true ; Microsoft.Office.Interop.Word.Document aDoc = WordApp.Documents.Add(); } 捕获(例外) { // 但是,您记录错误 MyLogger.Log(ex.Message); }



但实际上,您不应该这样做.您知道服务器上正在发生这种情况,对吗?它不会在客户端上显示任何内容.


hi i create post in the IIS Forum but they Can''t resolve it

i in my project use of this code in button :

Microsoft.Office.Interop.Word.Application WordApp = new Microsoft.Office.Interop.Word.Application();

var path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "New" + ".docx");

object fileName = path;
object readOnly = false;
object startIndex = 0;
object isVisible = true;
object missing = System.Reflection.Missing.Value;

WordApp.Visible = true;

Microsoft.Office.Interop.Word.Document aDoc = WordApp.Documents.Add();

i in visual studio when click on button,to be open word office but when i published on iis7 ,when i click on button ,don''t open word office

please help me

For starters, office automation on a web server really isn''t recommended.

http://support.microsoft.com/kb/257757[^]

Is Office correcrly installed on the web server? Does the account running the web process have permissions to all the relevant locations. Any messages in event viewer?

Why not try wrapping your statement in a try-catch block, and then log the Exception to a file.

try
{
    Microsoft.Office.Interop.Word.Application WordApp = new Microsoft.Office.Interop.Word.Application();
 
    var path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "New" + ".docx");
 
    object fileName = path;
    object readOnly = false;
    object startIndex = 0;
    object isVisible = true;
    object missing = System.Reflection.Missing.Value;
 
    // WHY make an application visible on the server?????!
    WordApp.Visible = true;
 
    Microsoft.Office.Interop.Word.Document aDoc = WordApp.Documents.Add();
}
catch (Exception ex)
{
    // However you log errors
    MyLogger.Log(ex.Message);
}



But really, you shouldn''t be doing this. You do understand this is happening on the server, right? It''s not going to show anything on the client.


这篇关于我无法在iis7上开设办公室的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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