We are accessing outlook through redemption DLL in c#.net. We are using various services like: importing contacts, calendar integration etc. Sometime we are getting exception from redemption COM like:
The file abc.ost is in use and cannot be accessed.
'MyApplication' exited without properly closing your Outlook data file
Could somebody help us to identify the root cause of this issue?
Exception details are mentioned below:
Exception1:
OutlookServices.OutlookService -
System.Runtime.InteropServices.COMException (0x80040119): Error in
IMAPISession.OpenEntry: MAPI_E_EXTENDED_ERROR
Error: 'MyApplication' exited without properly closing your Outlook
data file
'C:\Users\abc\AppData\Local\Microsoft\Outlook\abc#org.com.ost'.
'MyApplication' must be restarted. If this error message recurs,
contact support for 'MyApplication' for assistance.
at Interop.Redemption.IRDOSession.GetMessageFromID(String
EntryIDMessage, Object EntryIDStore, Object Flags)
Exception2:
OutlookService - System.Runtime.InteropServices.COMException
(0x8004011D): Error in IMAPISession::OpenMsgStore:
MAPI_E_FAILONEPROVIDER
Error: The file
C:\Users\abc\AppData\Local\Microsoft\Outlook\abc#sigmacare.com -
abc.ost is in use and cannot be accessed. Close any application that
is using this file, and then try again. You might need to restart your
computer.
at Interop.Redemption.IRDOSession.GetDefaultFolder(rdoDefaultFolders
FolderType)
Are you sure your application was terminated gracefully? Do you release Redemption objects as soon as you are done with them?
Are both your app and Outlook running in the same security context? Is either app running with elevated privileges (Run As Administrator)? Normally, OST files can be shared between different processes (e.g. outlook and your process) as long as the security contexts are the same.
Related
IIS 10 will not restart on my PC. When I navigate to localhost, I get a 'localhost refused to connect' message. After looking through the event viewer, it turns out that the issue is that the Windows Process Activation Service (WAS) will not start.
The error message given is:
'The Windows Process Activation Service (WAS) encountered an error while handling key generation. This will prevent WAS from starting corrently. The data field contains the error number.'
When I try to start the service manually from the services app, I get the following:
Has anyone experienced this issue before? Any help would be greatly appreciated, I've been trawling the internet for several days trying to find a solution to no avail.
We've run into this issue several times after recent Windows Updates. In all cases, the following worked (got from a Microsoft support rep):
Run the following from an admin Powershell prompt:
reg delete HKLM\SYSTEM\CurrentControlSet\Services\WAS\Parameters /v GenerateKeys /f
net start w3svc
The keys will be regenerated, then the IIS AppPools can be started
According to your error message, WAS can not access the machine key when start up. Usually, machine keys are used to encrypt sensitive information in config file, WAS will not be able to start if there is no machine key to use.
The easiest and most common method is to try to uninstall and reinstall WAS.
If it still can not start, try to delete the registry entry NanoSet with cmd.
If the above two methods are useless, you can refer to this to delete machine keys, let WAS create new one while starting.
If somebody is still fighting with this issue, please check Event Viewer under System filter and check for any logs related to WAS. In my case I found the following entry:
The Windows Process Activation Service (WAS) encountered an error while handling key generation. This will prevent WAS from starting currently. The data field contains the error number.
So I just started again CNG Key Isolation service and everything is working now.
I am trying to understand the procedure of Integration the IM Client with Outlook 2010. The below link is used for this :-
https://msdn.microsoft.com/en-us/library/office/jj900715.aspx
Outlook is able to reach the CreateInstance method of my implementation.
If I have the Lync Client installed than the controls reaches till GetInterfaceMethod, in which I am returning the object of ILyncClient.
There is no progress after this. Following error is showed in the outlook debugs :
MsoIMProviderFactory--HrEnsureDefaultIMAppRegKeys Succeeded opening reg key (HKCU-SOFTWARE\IM Providers)
CMsoIMProviderFactory--HrEnsureDefaultIMAppRegKeys Succeeded querying reg key (HKCU-SOFTWARE\IM Providers-DefaultIMApp-IMapp)
CMsoIMProviderFactory--HrEnsureDefaultIMProcessRegKey Succeeded opening reg key (HKCU-SOFTWARE\IM Providers\IMapp)
CMsoIMProviderFactory--HrEnsureDefaultIMProcessRegKey Succeeded opening reg key (HKLM-SOFTWARE\IM Providers\IMapp)
CMsoIMProviderFactory--WhichMessengerInProcessList Using (IMapp) process name for search
CMsoIMProviderFactory--WhichMessengerInProcessList Using (IMapp) process name for search
Guys please give your feedback regarding the same ?????
If I don’t have Lync Client Installed than control never reaches to Authentication Method.
A. Do we need to implement the IMessenger interface also ?
B. If yes then please show some pointers on how to do that ?
Any pointers to resolve this would be helpful.
For building the COM server we are using out of process COM example(CSExeCOMServer). I had tried the same setup with outlook 2013 also. In this too the output remains the same.
Environment :-
Windows 7 Service Pack1 .
Outlook 2010 & 2013.
You would always need Lync installed in you machine since the interfaces which you used in your code are defined by Lync. If you want to remove this dependency then you will have to register your typelibrary (.tlb) in the system. To generate .tlb you need an .idl file which you can explore on net how to get.
If you want to be an IM Provider then you need not implement this IMessenger interface. But if you want to work in Legacy provider way you will have to implement this interfaces(this i had not tried).
And to resolve your issue I would need the code snippet as how you are defining the LyncClient class. Once you share that then I would try to help you.
I was able to make this work in both outlook 2010 & 2013 but then I used C# way of implementing the COM Server.
I've noticed this off and on. If I'm locally debugging my Azure WebRole, in Visual Studio 2013, and I pause at a break-point for too long, the current request, or the next one, and all subsequent requests, will result in a 500.19 - Internal Server Error.
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
Detailed Error Information:
Module CustomErrorModule
Notification SendResponse
Handler Not yet determined
Error Code 0x80070490
Config Error The configuration section 'system.webServer/httpErrors' cannot be read because it is missing a section declaration
Config File \\?\C:\Users\<user>\AppData\Local\dftmp\Resources\11468ba0-d99a-45d2-bcce-eae28c7b4e2f\temp\temp\RoleTemp\applicationHost.config
Requested URL <request url>
Physical Path
Logon Method Not yet determined
Logon User Not yet determined
Event viewer says:
The worker process for application pool '902aa9af-0ed8-4126-be43-e533339bdeef' encountered an error 'Cannot read configuration file' trying to read global
module configuration data from file '\\?\C:\Users\<user>\AppData\Local\dftmp\Resources\11468ba0-d99a-45d2-bcce-eae28c7b4e2f\temp\temp\RoleTemp\applicationHost.config',
line number '0'. Worker process startup aborted.
And if I go check that directory I see that the file isn't there. I'm guessing the file WAS there at some point, because I was able to make requests prior to that.
Restarting the WebRole seems to fix the problem.
99% of the time this isn't a problem, so I'm sure there isn't actually an error in the config file, it just makes debugging "stressful" since I always feel like I'm under some kind of time limit. :(
I'm using WatiN in a console application. I set platform to x86, and I added [STAThread] to my Main. I confirmed that the application is actually running in 32-bit mode (which WatiN requires).
WatiN works fine when testing locally, but crashes when running on AppHarbor:
[COMException: Retrieving the COM class factory for component with CLSID {0002DF01-0000-0000-C000-000000000046} failed due to the
following error: 80080005 Server execution failed (Exception from
HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)).]
0007FFB8B2184B3 WatiN_Core!WatiN.Core.IE.CreateNewIEAndGoToUri(System.Uri,
WatiN.Core.Interfaces.IDialogHandler, Boolean)+0x103
How can I get WatiN working on AppHarbor?
To be able to run WatIn it need to have access (as an administrator) to some resources. When you run a COM object it needs to be able to query the registry to find out if Internet Explorer is a COM object in that system and if it is launch it. I don't have first hand experience with AppHarbor but I'm pretty sure they won't allow you to be able to query what COM servers their machines have so they won't provide you with that access.
To be 100% sure about this you should ask them if you can have access to query COM objects on their machines.
When you run it on your local machine that works because either you are logged in as an admin or you are launching the process as an admin.
Hope this helps.
In my windows task scheduler, I have scheduled a task to run a c# console application executable on a daily basis. This application sends some data to the database and then sends an email.
When I run it normally it works but however when it is run through task scheduler, it sends data to the database but is unable to send the email.
Any ideas on how to fix this?
EDIT:
Yes I can send correctly through console application. It uses default network credentials..However when I look at the event logs I have the following .NET Runtime exception logged:
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.IO.IOException
Stack:
at iTextSharp.text.pdf.PdfPages.WritePageTree()
at iTextSharp.text.pdf.PdfWriter.Close()
at iTextSharp.text.pdf.PdfDocument.Close()
at iTextSharp.text.Document.Close()
at ReadReutersRates.Program.SavePDF(System.DateTime)
at ReadReutersRates.Program.Main(System.String[])
I think it has something to do with pdf file which I am attaching to the email. But it's quite strange that this works when I manually run it.
This is a permissions error, the user you're running the task as when running through the console will have more permissions than the user running the task.
It appears the PDF app you are using is trying to write to a temp file or similar and it doesn't have permissions. (I'm assuming the email has a PDF attachment or similar that is being generated on the fly)
If you made your task run as an administrator that should work, you could then run it as a more restricted user and work out which permissions to apply to where to lock it down.