- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在使用 Microsoft Office Excel Interop 在 ASP.NET C# 中创建一个 excel 文件。当我在 Visual Studio 2010 中运行应用程序时,一切都成功了。我已经在我自己的 IIS 服务器上发布了我的 Web 应用程序,没问题。但是当我在 Windows Server 2008 中发布应用程序时,发现了问题。我在网上找了很多,我做了以下,但问题仍然没有解决:
我已将 Application Pool Identity 设置为 LocalSystem。在运行 -> mmc -32 -> 组件服务 -> 我的电脑 -> DCOM 配置 -> Microsoft Excel 应用程序 -> 右键单击 -> 属性窗口:在 Identity 选项卡中,我检查了所有 radio 此窗口中的按钮。
我已将 Application Pool Identity 设置为 NetworkService,并且我再次检查了所有之前的单选按钮。
在运行->mmc -32 -> 组件服务 -> 我的电脑 -> DCOM 配置 -> Microsoft Excel 应用程序 -> 右键单击 -> 属性窗口:在安全 选项卡中:我为 INTERACTIVE、NETWORK SERVICE、IIS_IUSRS 用户提供了Local Launch 和Local Activation。
这是我使用 Interop Excel 编写的代码:
Excel.Application xlApp = new Excel.Application();
object misValue = System.Reflection.Missing.Value;
Excel.Workbook xlWorkBook = xlApp.Workbooks.Add(misValue);
Excel.Worksheet xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
Workbook.SaveAs(Server.MapPath("DownloadFolder\\" + fileName + "_siyahi.xls"));
最佳答案
我发现了我的问题。在我的 Windows Server 中,系统区域设置 不是美国,我在我的代码中设置了 worksheet.cells.NumberForm="0.00"。
xlWorkSheet.Cells[rowNumber, 4].NumberFormat = "0.00";
服务器不知道这种数字格式。我已将格式更改为英语(美国),将当前位置更改为美国,我的问题就解决了。
关于c# - Microsoft Office Interop Excel 不保存在 Windows Server 2008 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18463952/
我是一名优秀的程序员,十分优秀!