Access windows server 2003 share folder from windows server 2008 - c#

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.
:-)

Related

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

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.

DO I need to setup sql server in a computer to run c# desktop application file made in vs 10?

I have a desktop application made in vs 10 with sql server 8. I have added the mdf file in app_code folder of project and the app.config is changed accordingly.The application is published and is availabel as setup file(.exe).If i want to install it in another pc, do i need to install the sql server in that pc?
The short answer is Yes
The idea is database needs a server to host it and an engine to run it
mdf file has no value without sql serve and access files has nothing to do if you don't have MS Access installed, etc.
But this does not mean db server must be installed on the client machine that has the application. as it can be on another machine or on the cloud (i.e. hosted on the internet)
As long as your application is connecting to that machine/server

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

VPN authentication in C#

I have a VPN in my office. One machine has windows server 2003 installed. I am coding an app in C# to upload files from a machine connected to the server machine on a shared folder.
The file transfer code has been written, but it throw Access denied exception when I run it.
However when I open the shared folder using windows explorer and key in my username and password, then it works like a charm.
I need to know why it's throwing this exception and what code should I write to automatically authenticate myself from the code without going to windows explorer and entering credentials there.
Update --
.net version is 2.0, I can upgrade if its necessary but I dont think its the issue.
Iam running the application on the local machine.
I solved the issue using impersonation.
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q306158
http://www.codeproject.com/KB/cs/cpimpersonation1.aspx

Categories

Resources