Я пытаюсь отправить встречу Outlook со своей страницы asp.net, и она отлично работает, когда я работаю в IDE VS2008. Но когда я опубликовал это и настроил как виртуальный каталог я получаю сообщение об ошибке ниже.
Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80070005.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.UnauthorizedAccessException: Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80070005.
ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.
To grant ASP.NET access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[UnauthorizedAccessException: Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80070005.]
_Default.SendAppointment() +42
_Default.Page_Load(Object sender, EventArgs e) +13
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +50
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627
Мой код как ниже
using System.Reflection;
using OutLook = Microsoft.Office.Interop.Outlook;
using System.Runtime.InteropServices;
private void SendAppointment()
{
try
{
OutLook.Application app = null;
OutLook.AppointmentItem appt = null;
app = new OutLook.Application();
appt = (OutLook.AppointmentItem)app.CreateItem(OutLook.OlItemType.olAppointmentItem);
appt.Subject = "Test subject";
appt.Body = "Test";
appt.Location = "TBD";
appt.Start = DateTime.Today;
appt.End = DateTime.Today.AddDays(1);
appt.ReminderSet = true;
appt.ReminderMinutesBeforeStart = 15;
appt.Importance = OutLook.OlImportance.olImportanceHigh;
appt.BusyStatus = OutLook.OlBusyStatus.olBusy;
appt.Save();
appt.MeetingStatus = OutLook.OlMeetingStatus.olMeeting;
appt.RequiredAttendees = "rssabu@company.com";
appt.Send();
Response.Write("Done");
}
catch (COMException ex)
{
Response.Write(ex.ToString());
}
}
Может ли кто-нибудь помочь мне решить эту проблему? Я уверен, что это что-то с безопасностью. Приведенный выше код хорошо работает при запуске в VS 2008 IDE. Пожалуйста, совет