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
Related
I have 2 visual studio 2010 projects that use Crystal reports ver 13.02 differently.
1 works and the other is getting an object reference not set to an instance of an object error.
The first app, I developed from the ground up as a web application, that uses several existing crystal reports and are working using the crystal reports viewer. Its is a web application project using asp.net 4.0 framework in c#.
The other project was an older VB website project that I upgraded from .net 2.0 to 4.0 and was working fine until I had to upgrade it to 13.02. This project does not use the viewer but only prints the data to the report. On my development laptop under visual studio it runs and prints fine, but not when published to both my laptop's IIS 7.5 and the server's IIS 7.5.
I get this error and have exhausted every possible option. It can't be the driver as the web applications project works fine on both my machine and the server. I'm suspicious that I will be forced to convert the project to a web applications project before an answer is found... but would prefer to find an answer to resolve it as it is.
Update
After further debugging I have discovered that the problem is the PrintToPrinter method that, again, works fine in development mode, but not when published.
Does your web.config file for the VB application have all the necessary Crystal references? I've been learning over the last few days that it's pretty quirky.
Resolved Issue
The printer really was not found, despite being there. This is because IIS does not have the same access to resources as does users, rightfully so, and access needs to be granted through either the registry entry under the default users key or security options for the printer need to be set to an IIS account to be set under the Identity option under IIS, in the application pool that the web application is using.
The complete process is also detailed at this link SAP site where the result was two fold.
I used this code snippet to loop through all available printers (I copied and pasted this from SAP, I used C# for my app and creates a list box to add) and showed them on the web page during the print process:
Dim myPrinter As String
For Each myPrinter In System.Drawing.Printing.PrinterSettings.InstalledPrinters
add to list
Next
Under the web server, through Computer Management I added the Local Service IIS id to the Print Operators group.
Under IIS, using the "Advanced Settings" of the Application Pool the web site is using, I changed the Identity field to LocalService
I verified the printer was now available by running the code snippet again and it was, then printed the report and it ran and printed fine.
It took a while to find this answer, and I could not have gotten there without the assistance provided which directed me to the answer. I hope this helps out someone else.
You need to download and install CR on you production server. *.msi
For example: CRRuntime_64bit_13_0.msi
I have developed a web service in VS2008 in C#. The service queries a SQL Server Express 2012 database and returns the results. When I test the service on local development system it works fine.
Now I have a windows azure trial account, and I want this service to be deployed on a virtual machine.
1- I have tried to create virtual machines with SQL server and Visual Studio on it, but could not create the service there. VS does not have the Web services template there.
2- I have tried to create the deployment package on my dev system and tried to install the service but it also did not work.
Please suggest the correct way of doing this task. I am very much new to all these concepts so may be I am missing some basic information and a step by step guide will not hurt.
Install Visual Studio 2012 Express for Web
Get your application working in that version, and preferably upgrade it to .NET 4.5.
Create a Windows Azure SQL Database by following this Getting Started guide.
Download version 4.0.15 of the SQL Azure Migration Wizard from CodePlex.
Use the wizard to migrate your local database to Azure, being sure to fix all the problems it reports.
Set up a Windows Azure Web Site and publish your service to it as described in this article.
I am not sure that you did it that way, but the easiest way to create a cloud-hosted web service with MS SQL Backend would be:
Create a new instance of SQL Azure in Azure Management Portal.
Create a new database (probably a web edition in your case).
Use the connection string from the portal and Azure SDK to develop an ASP.NET application (web role) hosted on Azure. You can locally test this application in the similar way how you test your current ASP.NET application, provided you set up the firewall on your SQL Azure instance for inbound connections from your external IP.
(here is the step-by-step tutorial for the first three steps)
Create a new instance of cloud service in Azure management portal.
Deploy your application to the cloud directly from Visual Studio. You'll, however, need at least Visual Studio 2010 and the Express Edition would already do.
(Update: As Mark Rendle suggests in the comment and in his answer, there is no need to create a separate cloud instance as long as your service is light-weight and does only data fetching. Cloud instance would be, however, essential, if your service requires data processing or has some other logic entailing long-running processes).
Alternatively you might want to use Azure Mobile services, that already provide a web service for SQL Azure that might do. This is a fully RESTful web service and you'll just need to write some logic in JavaScript, similar to Node.js implementation. See an excellent tutorial on this issue.
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.
I have a C# web service that I am trying to debug in Visual Studio 2008, and when I try to run it, Internet Explorer pops-up as expected, but it just displays 'waiting for response from localhost...' in the status bar. I have left it running for a few minutes and it never responds.
I have other web services that I am able to debug fine, is VS2005 and 2008. The problem web service is impersonating a different identity in the web.config file, but I have no problems with this same user on a different web service (in VS2005).
Does anybody have any ideas on what might be preventing it from starting up? Interestingly, a colleague has the same problem with a web service that IS working on my machine, even though we are working with identical code. Something must be configured differently...
By the way, I've noticed that the 'Temporary ASP.NET Files' folder is missing from both
C:\Windows\Microsoft.NET\Framework and C:\Windows\Microsoft.NET\Framework64... I certainly haven't deleted them, and other web services debug okay, so is this just a red herring?
We are also on a domain which has its own firewall (outside of the developers' control) - could this be blocking it?
EDIT: I have just removed the user impersonation for a quick test, and it worked. So there must be something about Visual Studio 2008 that does not want to run when impersonating THIS particular user. Any ideas what configuration I would need to change to correct this?
I have had the same issues with impersonation; I don't know if Cassini (the built-in VS web server) supports this properly. About the best advice I can give is to either use Local IIS with an app pool running as your impersonated user or to attach your debugger using remote debugging to a remote IIS server.
I believe using Local IIS will attach correctly & automatically if configured as much in the Web tab of Project Properties. You'll have to run VS as an admin to get the virtual directories setup automatically by VS in IIS.
I created a service that has a database connection which is working fine in Cassini, when in copy the service to the inetpub all works fine except database calls, they always return this error:
The server encountered an error processing the request. See server logs for more details."
Now i have 2 questions,
I can find server logs in my C:\inetpub\logs\LogFiles\W3SVC1 folder. But are these the ones mentioned because these do not seem to contain any usefull data.
How is it possible that everything works in Cassini but not in IIS?
If there are any questions about my question please go ahead!
Edit I am using Visual studio team system 2008 and IIS 7.0
This is normally a permissions problem.
If you are using defaults:
The connection string is using a trusted connection
When you run via cassini you are in the security context of your user
When you run via IIS you are in the security context of the identity of the application pool which is network service.
To fix it you could:
change the connection string
change the identity of the application pool
give network service access to your database
Run Visual Studio as administrator
My guess is permissions. Are you using Windows authentication?
In the case of Windows authentication:
http://www.codeguru.com/csharp/.net/net_security/authentication/article.php/c7725