下面的代码我在自己的电脑上运行没有问题,但是发布到服务器上,excel的运行,和传真的运行都没有反应,也没有报错误。 DateTime beforeTime;
        DateTime afterTime;
        beforeTime = DateTime.Now;        //创建Application对象
        Excel.Application xApp = new Excel.ApplicationClass();
        xApp.Visible = true;
        afterTime = DateTime.Now;
        // 获取当前行索引 
        int index = Convert.ToInt32(e.CommandArgument);        // 取出当前行数据键值对象中的值 
        string strGrup = ((GridView)sender).DataKeys[index].Values["in_no"].ToString();
        in_warehouse iw = new in_warehouse();
        iw.Where.Id.Value = strGrup;
        iw.Where.Id.Operator = WhereParameter.Operand.Equal;
        iw.Query.Load();
        out_warehouse ow = new out_warehouse();
        ow.Where.In_no.Value = iw.Id.ToString();
        ow.Where.In_no.Operator = WhereParameter.Operand.Equal;
        ow.Query.Load();
        Mcustomer mc = new Mcustomer();
        mc.Where.Id.Value = Convert.ToInt32(ow.Customer_no);
        mc.Where.Id.Operator = WhereParameter.Operand.Equal;
        mc.Query.Load();        //得到workbook对象,(打开已有的文件)
        Excel.Workbook xBook = xApp.Workbooks._Open(@Server.MapPath("../word/zbs/" + iw.Zbs_map), Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value);
        //指定要操作的sheet
        Excel.Worksheet xSheet = (Excel.Worksheet)xBook.Sheets[1];
        //写入数据
        Excel.Range rng3 = xSheet.get_Range("A1", Missing.Value);
        rng3.Value2 = "青海桥头铝电有限公司        " + mc.Title.Substring(2, 1);
        xBook.Save();
        //xSheet = null;
        //xBook = null;
        //xApp.Quit();
        //xApp = null;
        xBook.Close(null, null, null);
        xApp.Workbooks.Close();
        xApp.Quit();
        if (rng3 != null)
        {
            System.Runtime.InteropServices.Marshal.ReleaseComObject(rng3);
            rng3 = null;
        }
        if (xSheet != null)
        {
            System.Runtime.InteropServices.Marshal.ReleaseComObject(xSheet);
            xSheet = null;
        }
        if (xBook != null)
        {
            System.Runtime.InteropServices.Marshal.ReleaseComObject(xBook);
            xBook = null;
        }
        if (xApp != null)
        {
            System.Runtime.InteropServices.Marshal.ReleaseComObject(xApp);
            xApp = null;
        }
        GC.Collect();
        this.KillExcelProcess(beforeTime, afterTime);
        faxobject fb = new faxobject();
        fb.SendFax(Server.MapPath("../word/zbs/"), Server.MapPath("../word/zbs/" + iw.Zbs_map), mc.Title.Substring(1, mc.Title.Length - 1), "9," + mc.Fax_no);
        Response.Redirect("zbs_list.aspx");