سؤال

لدي ملف Excel على خادم الويب حيث ينتشر موقع الويب الخاص بي. السيناريو، لدي شاشة تسمح للمستخدم بتنزيل ملف Excel من خادم الويب وحفظ محرك الأقراص المحلي، ثم حدد مسار الملف نفسه لتصدير البيانات، لكنني أحصل على الخطأ أدناه.

asp.net غير مصرح به للوصول إلى المورد المطلوب. انصح منح حقوق الوصول إلى المورد إلى طلب ASP.NET هوية. يحتوي ASP.NET على هوية عملية أساسية (عادة {آلة} \ ASPNET على IIS 5 أو خدمة الشبكة على IIS 6) يستخدم إذا التطبيق غير منتظم. إذا كان التطبيق هو انتحال شخصية عن طريق، ستكون الهوية المستخدم المجهول (عادة iusr_machinenname) أو المصادقة طلب المستخدم. لمنح ASP.NET الوصول إلى ملف، انقر بزر الماوس الأيمن فوق الملف في Explorer، اختر "خصائص" وحدد علامة تبويب الأمان. انقر "أضف" لإضافة المستخدم أو المجموعة المناسبة. تسليط الضوء على ASP.NET. حساب، وتحقق من المربعات للوصول المطلوب.

هذا هو رمزي: giveacodicetagpre.

هل كانت مفيدة؟

المحلول

You cannot safely use Office Automation from a server process. See the answer to Editing an Excel document with Macros in ASP.NET to learn how far you have to go to make this safe. See ASP.NET Web Service using office 2010 COM to learn what can happen if you just try calling it from ASP.NET.

The problem, briefly, is that Office Automation was designed for the automation, from a desktop application, of the Microsoft Office products, which are desktop applications. All sorts of things don't work properly when you're using them from a server application.

نصائح أخرى

Do you have remote desktop access to this server?

You will need to set the permissions on the folder that the Excel file is being exported to as well as setup the permissions in DCOMCNFG so that the AppPool user can automate Excel. (Start, Run, DCOMCNFG, Component Services, Computers, DCOM Config and right click the Microsoft Excel object.

Have you considered an Excel writer instead? Such as EPPlus.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top