The rpc server is unavailable (exception from hresult : 0X800706BA) - vb.net

My application scan through the excel files and generate a report having count of Activex controls in each excel file. But while running the tool from client machine we are getting an error on opening the file (for some file not all) and the files are located in the sever side, as follows:
"the rpc server is unavailable (exception from hresult : 0X800706BA)"
Can you please guide me why this happens....
Thank you.

This usually occurs because the server you are communicating with has crashed.

When you first launch Excel programmatically, it connects to Excel via an RPC server. When you close the document, this server gets closed without your application knowing about it.
The solution is to trap an error and re-initialise your Excel object. you will then be able to continue.

its seems to be an well known error
s. Microsoft Support

I had the same and exact problem and upon searching online, nothing works. So I tried one of the comments to open and close Excel both local and server and it works!
If you have the same problem, try to open Excel or the Excel file you are using and close it.
Then try to run your application again.

Related

SSIS: Unable to Read from Excel file from a UNC path when deployed to server

I appear to be unable to get my deployed SSIS package to read from a 1997-2003 Excel file.
I get stuck with the following 2 errors:
SSIS Error Code DTS_E_OLEDBERROR, Error code: 0x80004005 An OLE DB
record is available. Source Microsoft JET Database Engine, database
engine cannot open the file, it is already opened exclusively by
another user, or you need permission to view its data.
DTS_E_CANNOTAQUIRECONNECTIONFROMCONNECTIONMANAGER with Error code 0xC0202009
The package itself works with no issues when using SQL data tools on the server logged in as the service account only when deployed to server I see this issue.
To make this issue even more confusing I have setup and tried the following:
Runtime is set to 32 bit on the debugging menu on SQL data tools as well as the job configuration is set to use 32 bit runtime
I am able to UNC to the folder/file when logged in as the SQL service account
Any Ideas?
Thanks,
M
I figured it out in the end. Turns out I missed a step with the permissions.
Yes the Service account had permissions to the folder but I failed to add read permissions to the file itself.
Thanks for all comments/suggestions.
M

Unable to create XLS file on web server

We have a WCF application on our web server. One of the service methods in this app creates an Excel XLS file with data and places the file in a directory so the user can down load the file later.
Our problem is that when this app attempts to create the Excel object, we get this error: Error in Create Excel Helper Workbook, and Application: Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046}
failed due to the following error: 8000401a The server process could not be started because the configured identity is incorrect. Check the username and password.
This is the line that causes the error:
using EX = Microsoft.Office.Interop.Excel;
EX.Application Application = new EX.Application(); //causes error
I did some research and what I have tried is to go into DCOMCNFG - Computers - My Computer - DCOM Config and Right clicked "Microsoft Excel previewer" - properties - Security, then added several groups and users to have Local Launch, Local Activation, etc....
But this did not help. Some of the articles say to choose "Microsoft Excel Application". However, I only see "Microsoft Excel previewer" in my DCOM Config.
Excel is installed on this server but we still have the above problem.
One strange thing is that if I remote into the server, then have my client(browser) on my PC call the service method to create the XLS, this works without a problem.
What do I have to do to resolve this issue?
You can attempt to make this work by setting the IIS AppPool Identity to a user that has interactive logon rights. The interop assemblies actually work by launching an Excel instance on the server and then communicating with it to perform work.
That being said, having gone down this road before, it is a poor solution. The challenges you'll face are as follows:
Issues with DCOM permissions that are difficult to diagnose and resolve (you're running into this now)
Excel processes get spawned on the server and half the time do not close properly, so your application has to be smart enough to go around killing errant Excel processes, or living with the fact that your application is going to leak memory like crazy
It isn't supported or recommended by Microsoft
Office wasn't designed with server-side security considerations in mind
See the following for additional details:
https://support.microsoft.com/en-us/kb/257757

SSIS package execution completed but no errors and Excel destination is empty?

I have an SSIS package that reads data from an Excel source and separates out into invalid data with a reason field or valid data if it passes all my validation checks (i.e. duplication checking, valid responses, etc.). The invalid and valid files are Excel destination files.
The package runs as expected on my old laptop connected to the network. I've had to change to a new laptop and worked with IT to install all the same SQL Server software. On the new machine, connected to the same network with the same login credentials in my data sources, the package does not run as expected.
I click debug and it looks like it's processing as normal and I receive the message, "Package execution completed. Click here to switch to design mode, or select Stop Debugging from the debug menu." I stop debugging and it looks like all rows were sent to the invalid Excel file as expected. But when I open the file, it's empty. The valid Excel file is also empty.
I'm wondering if there is a compatibility issue with the version of Microsoft Excel on this machine? This setup has MS Excel 2013 with some patch that allows accessing 2010 version files. The old setup had MS Excel 2010. I'm running SQL Server 2008 R2.
Any help is greatly appreciated.
Thanks,
Sisto

How to handle Outlook's "Outlook is using an old copy of your data file (.ost). Exit outlook and blablabla" error at an API level using VBScript?

I have created some automated scripts in VBS to execution some tasks automatically on a remote virtual machine. However, whenever I want to email the result to the people that it concerns, Outlook, on start, gives me this error, preventing me from sending any email. The script could not send anything until I manually dismiss this message (but I did not have to actually solve this). The client machine that sends email is a remote virtual machine. It is managed by a driver machine (another remote virtual machine) in such way that every time a new build comes out the client machine gets restored to a checkpoint and downloads the build and installs it and then tests it. It seems that since it is using a snapshot, the outlook data file will have to be out-of-sync with what's on the server, possibly causing the aforementioned error.
Does anyone know how to handle this error in VBScript? Thank you in advance!
You could try to avoid the use of outlook.ost at all. Turn off cached mode (for Exchange) or turn off any Send/Receive settings for folders. Close Outlook and rename outlook.ost to .old.
Open Outlook and check too see if outlook.ost is not created again.

Differences in execution of console application directly from .exe vs executed via task schedule?

im working on a Window server 2008, in this server i developed a vb.net 2008 console application that open a excel 2003 file and use its contents to create a xml file, so i have two situations:
1. Differences in execution of the program: if i run the application from the Visual Studio or directly from the executable it open and process the excel without problems but if i configured a task on the windows task scheduler or in the adtempus that execute this program its failed and throws this exception:
Exception from HRESULT: 0x800A03EC- at Microsoft.Office.Interop.Excel.Workbooks.Open(String Filename, Object UpdateLinks, Object ReadOnly, Object Format, Object Password, Object WriteResPassword, Object IgnoreReadOnlyRecommended, Object Origin, Object Delimiter, Object Editable, Object Notify, Object Converter, Object AddToMru, Object Local, Object CorruptLoad)
at .Module1.convertExcelToXmlFile(String excelFile)
i have read alot about this exception, but at the moment im unable to resolved, so I want to know how this program can execute correctly from Visual Studio or directly from the execute but failed when its execute on a task if both situations are in the same server? is there a way to fix this behavior?
2. In the console application when i open the excel file with the open method, the file in excel appears for a few seconds then it closed, is there a way to access the excel file contents but that the file dont show in Ms Excel?
thanks.
You should not be using Office Interop in an unattended process.
Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.
If you are building a solution that runs in a server-side context, you should try to use components that have been made safe for unattended execution. Or, you should try to find alternatives that allow at least part of the code to run client-side. If you use an Office application from a server-side solution, the application will lack many of the necessary capabilities to run successfully. Additionally, you will be taking risks with the stability of your overall solution.
http://support.microsoft.com/?id=257757
There are a number of products that will manipulate Excel docs and run correctly unattended.
Is the Excel file you're trying to open on the network?
If so, the problem is most likely because your Task Scheduler service and any jobs it runs are (by default) running under the local SYSTEM account, which is prohibited from network access.
If you change the task to run under a different account (say, for example, a domain account that you have given privileges for the remote fileshare). (Note that this change may effect how other scheduled tasks run, so you'll want to be quite sure of the permissions needed.)
Just in case you have not figured it out yet, the most-likely resolution which worked for me can be found at this URL :
https://social.msdn.microsoft.com/Forums/en-US/b81a3c4e-62db-488b-af06-44421818ef91/excel-2007-automation-on-top-of-a-windows-server-2008-x64?forum=innovateonoffice
If your server is a 64-bit one, create a folder named 'Desktop' in the below mentioned path i.e. C:\Windows\SysWOW64\config\systemprofile\Desktop
If your server is a 32-bit one, please make this folder C:\Windows\System32\config\systemprofile\Desktop