Excel.Interop unable of progressing after a new instance is initialized - c#

I am sitting with the following issue: after a new instance of Interop.Excel.Application() is initialized, my application hangs without timeout or any other progress/exception, nadda.
A bit of background, it is a brand new installation of Office 2013 on a Windows 2012 R2 server. I have got an IIS application pool running under a unique built-in account. This specific account has got full administrative rights on the server. I have added Local Launch and Local Activation DCOM configuration permissions for this specific user under the Component Services > Launch and Activation Permissions section and also created the Desktop folder on System32\config\systemprofile.
Below is the code I use to instantiate a new instance of Excel:
var excelApplication = new Microsoft.Office.Interop.Excel.Application();
On our dev environment, I do not have this issue and I also did not have to specifiy the DCOM configuration permissions. The Dev environment is running on a Windows 2008 R2 Standard server and Office was also newly installed a couple of weeks ago. Same configuration on IIS applies whereas it is a unique built-in account for the application pool identity.
Any help would be greatly appreciated!

It turned out that the IIS custom-account user did not have adequate permissions on the production server. Once the account was updated, it worked.

Related

VS 2012 & IIS Express With Windows Authentication

I have successfully setup my development environment on one machine utilizing IIS Express and Windows Authentication to essentially force a web application to use SSL. When I pulled the code down onto a secondary dev machine, I've run into all kinds of issues.
It appears that the startup URL as defined in the project properties while working on the initial dev machine needed to be resetup on the new machine. I went into the IIS Express config and made sure that anonymous authentication was disabled and Windows Auth was enabled. I also added the bindings to essentially replicate what the initial dev machine was setup as.
I then opened the web app in Visual Studio again and this time received no errors or warnings. I figured no errors meant things would be OK.... Whoops...
The app now appears to load and I'm immediately challenged for my windows credentials. I enter them, and then get re-challenged. It appears there is some kind of loop going on here.
1. What am I doing wrong?
2. Shouldn't there be a better way for distributed development and IIS Express (SSL)?

MySql database connection issue

I have an ASP.NET application, that connects to a mysql database. If on the server I run the web site in visual studio (which uses development server), it can connect to the mysql database correctly.
However, if on that same server I use IIS, an exception 'Unable to connect to any of the specified MySQL hosts' is thrown. It is configured to use an application pool with identity as 'ApplicationPoolIdentity'.
Connection string is like:
<add name="MYSQLConnectionString" connectionString="uid=name;server=111.11.111.111;Pwd=password;database=dbname" providerName ="MySql.Data.MySqlClient"/>
What could be the problem?
When your debugging with Visual Studio the account is local admin and has rights to everything most likely. The IIS default application pool account does not have these elevated privileges. Make sure the account that your IIS site application pool is running under has the correct permissions, or temporarily change the account to be local system to see if it is a permssions related issue. You can use FileMon to trace what files or registry entries the default account is having trouble accessing.
[EDIT]
Most likely you installed MySQL to someplace like C:\MySQL and you just need to grant the IIS application pool account read access to that directory, and possibly a registry entry or two.
The site was not installed in the root, but as an application in the default web site. If we run it as the root site, it works. Don't know why exactly though.

Access windows server 2003 share folder from windows server 2008

I am creating a windows service application to run on a Windows Server 2008. Another windows server 2003 server running on a different live IP exists. Both these servers are from the same providers, and belong to the same network. A shared folder exists on the WS2003 server.
From the Windows Service i am trying to access the shared folder using UNC Path (\Server2003IP\SMSFiles), where it gives error.
if (!System.IO.Directory.Exists(PATH_SMS))
throw new ApplicationException("Could not find or access SMS folder");
The Windows service is installed & I tried giving the Logon as the System Administrator also. But no luck.
FYI - The same scenario by keeping the shared folder on WS 2008 & installed the service on WS 2003 and the whole thing worked fine.
Any Helping Hands Please
After searching online and testing various scenarios, i was able to fix the issue.
Solution: Both the servers should have a user with the same Username & Password and give permissions for the folders. Also run the windows service under this particular Login User.
:-)

Install or Configure Interop.Microsoft.Office.Interop.Word.dll

Situation: I have web application in my pc, who manipulates docs to generate pdfs with no problem. I configured my dcomcnfg to work fine because I had the problem with access permissions the COM.
The problem: I have to put the website in the server. The server has Win8 Enterprise. Doesn't have Visual Studio installed, only framework 4.0 and the Word Office. When I try to generate pdf it always return this error: Retrieving the COM class factory for component with CLSID ...
I run dcomcnfg and customized all permissions to IIS service (doesn't work and put to) Everyone. I Set all Launch and Activation permissions to allow Everyone, I also set Access Permissions and configuration permissions.. And still don't work.
I have to register the dll in server?(How I do it?)
I need more configurations?
I Have to install all Office?
ps: Office 2013
while it is not recommended to use this on server, there is a possible solution:
impersonate the admin in the asp.net application:
http://msdn.microsoft.com/en-us/library/aa292118%28v=vs.71%29.aspx
it may have security issue.

Accessing SharePoint content (list) from a WCF service

I've written a WCF service which tries to read the list items from a particular list in SharePoint. For testing purposes I run the WCF service using Visual Studio ASP.Net Development server. I pass the Site ID to the web service and from the web service I try to open the List and read the items. But when I try to read the items I'm getting the following error -
This operation can be performed only
on a computer that is joined to a
server farm by users who have
permissions in SQL Server to read from
the configuration database. To connect
this server to the server farm, use
the SharePoint Products and
Technologies Configuration Wizard,
located on the Start menu in
Administrative Tools.
Here are some facts -
I'm using SharePoint 2007 x64 in
Windows Server 2008 x64 and it is a
single server installation (no farm)
I'm a Farm administrator
I'm a System Administrator (but not
domain administrator)
I'm a SysAdmin for the SQL Server
2005 server in which is SharePoint
is having its databases
I'm the Site Collection
Administrator in which the List is
present
I opened Visual Studio 2010 as
adminsitrator
In task manager, the ASP.Net
development server process is
running under my account
I don't have any idea why I'm getting that error. Any ideas?
is the WCF service runnig on the sharepoint computer ? I bet you are trying to use the SharePoint object model outsite the sharepoint box.
If you want to access remotely to the sharepoint data, in a WCF service on your own, or actually any other program, you will have to use the Lists.asmx web service to retrieve your data from sharepoint.
In fact, in your WCF you will have to act as a client to the SP services
[edit] my bet was wrong :) here is another thing to check
Also take a look in your VS project. Setup your target platform to "AnyCpu" or "X64" to ensure the program will use the correct assemblies and registry keys.
The object model will try to open the reg key under HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node node if you process is 32 bits, instead of HKEY_LOCAL_MACHINE\SOFTWARE where the sharepoint config resides
Try to check your sharepoint application pool identity. If you, for example, trying to evelate you priviligies using RunWithEvelatedPrivilegies in your service, and app pool identity doesn't have required permissions, you will get such message.
Okie. I found the issue. It is related to the same problem which I've been facing since I switched to x64 development in SharePoint 2007. When I deployed the WCF service to IIS everything worked fine.
Using Visual Studio 2010 (no matter what my target platform of my project is) I've never been able to access SharePoint content through a simple console application or a simple asp.net web application. I've clearly understood that the problem is with the x86 x64 stuffs and I've not been able to resolve it till now. I've been haunted by this for so long now.
If you have any comments on this answer please post it.
Old Ref - Filenotfound exception while opening an SPSite object - x64

Categories

Resources