I have a Silverlight 4 Beta application where I'd like to use the SharePoint object model to upload a document to a SharePoint site - should be simple enough, except an exception is thrown at:
using (SPSite siteCollection = new SPSite(siteCollectionUrl))
The Web application at
http://intranet.fabrikam.com could not
be found. Verify that you have typed
the URL correctly. If the URL should
be serving existing content, the
system administrator may need to add a
new request URL mapping to the
intended application.
This particular exception is actually really well documented out there, it's obviously masking a real underlying issue. Here are some of the things I've read about and tried without success:
DNS / Host Header:
This exception occurs when the particular URL isn't in the IIS metabase because it's being handled by DNS. My web application has an AAM set up and a host header on the web site in IIS. I also tried running the code without using the FQDN of the site, e.g. http: //servername:4860.
Permissions:
The identity of the the Silverlight application pool has db_owner permissions to my content database, and is also a site collection administrator. I can't have both web sites use the same application pool because the Silverlight application needs to run in a .NET app pool.
x86 vs x64:
My Silverlight application has to be compiled for x86 - I'm using some controls that only work in x86. The installed SharePoint version is x64. I've read about people seeing this exception when trying to use the SharePoint object model to hit a x64 SharePoint installation from a x86 app.
Adding then removing permissions for the account: This begins to border on some voodoo magic, but I read about people magically resolving this issue after removing the permissions they set trying to troubleshoot this problem initially. No luck here.
Would appreciate any suggestions, thank you!
Silverlight runs on the client/browser, not on the server - so the server-side SharePoint object model will not be available to you.
However, there is an object model for SharePoint 2010/Silverlight apps - see this MSDN article for details.
To fix the particular error you mentioned, use "List", instead of "SPList". The Silverlight SharePoint object model is a little different from the basic non-Silverlight SharePoint object model.
Related
Last year someone reported encountering this problem ("The Silverlight project you are about to debug uses web services. Calls to the web service will fail unless the silverlight project is hosted in and launched from the same web project that contains the web services.") and accepted the answer to "set the web project which hosts the Silverlight application to be your startup project."
I'm seeing the same message, but think the solution might have to be different. I am building in VS 2010 a Silverlight application to access the Google Weather API, with VB as the code-behind. The API will return a XML file with data for the specified city (ex., "http://www.google.com/ig/api?weather=london,england"). The Solution Explorer only shows my VB/Silverlight project ("GetWeather"), and the Project Properties dialog box shows the Startup Object as "GetWeather.App" -- the only choice. I'm trying to use a WebClient object to make the call and an XDocument object to parse the return. But I repeatedly get the above error message, with no other result. What am I doing wrong?
Thank you in advance!
I would add a simple Web project and configure it to host the Silverlight app. You'll need to host the app somewhere anyways, so why not create a stub ASP.NET application in your solution? The easiest way is to create a new Silverlight app solution selecting an ASP.NET web project as the host, and then copying your existing code to that solution. Then you should set the web project as the startup one. This should make debugging a lot easier.
Besides, do remember to configure the client access policy to enable cross-domain calls. Check out this article
I'm trying to authenticate my silverlight application to get windows user name, which then I use to get some further information. Have looked it up, but the answers I found were about configuring the web service to get it. Is there a way, to get windows credentials strictly in Silverlight? I cannot find .Credentials, the only thing I see is .ClientCredentials, but apparently it doesn't show the required information. I am getting the string "System.ServiceModel.Security.UserNamePasswordClientCredential". It actually allows me to set up the name, not retrieve it. Also there is a web service called authentication.asmx, but as before it applies to other purposes. Neither do I have any web service I could reference to and configure them. Or am I missing something? Perhaps I can retrieve the windows credential by NTLM or Kerberos? I am using Visual Web Developer 2010 Express with Silverlight 5.
My Experience is that the Membership framework that is present in the asp.net world is not available in silverlight. In order to achieve something similar I had to implement a web service (WCF) that was directed at the domain's active directory (ldap) server. Silverlight is a very strict framework in terms of interoperability, its good for security but has some limitations.
I am not sure about your level of knowledge of the active directory but here is a link that deal with a lot of the possible operations and has sample C# code to go along.
http://www.codeproject.com/Articles/18102/Howto-Almost-Everything-In-Active-Directory-via-C#40a
I have some issues deploying a Silverlight 4 application on a remote server machine. My application consist a Cosmopolitan theme (a master/child page model) that connected with 2 services to retrieve specific information.
The first service is pretty simple. It is an asmx service that sends back the User Logon name to the Silverlight application.
The second one is a LinqToSQL service that relay some information to some autocompletebox and search tool.
I have developed the application on my machine using a local SQL server. When I am testing locally with an address type like this one (http://localhost:4080), it is working perfectly. But when deploying on the server using the domain name, it is giving the error saying that the remote server returned an error: NotFound.
I followed and review every steps on of deployment but I still have a problem. I try by all means to find a solution to this problem. Of course go through the list of prerequisites provided on these sites:
http://msdn.microsoft.com/en-us/library/ff426912%28v=vs.91%29.aspx
First, I tried myself to deploy the application without having to disturb my network administrators that by installing the required dll’s in the Bin directory of my project. I have installed those 3 dll’s (System.ServiceModel.DomainServices.Server.dll, System.ServiceModel.DomainServices.Hosting.dll and Microsoft.ServiceModel.DomainServices.LinqToSql.dll). Of course, nothing worked.
I then ask the network administrator to install the WCF RIA services. Does he have to configure something other than installing the WCF RIA services? Is this service including the Microsoft.ServiceModel.DomainServices.LinqToSql.dll.
I suspect that my problem comes from a configurations file: ServiceReferences.ClientConfig or Web.config. But I have included the exact same information from the MSDN site of deployment so I do not see where my problem might be. Am I using the wrong technique to publish the project? I am publishing the site using the File System method and then after modifying the config file to point to the right domain name.
I am able to reach the services by typing the http://domainname/ MeritService1.svc. It is telling me that I can test with the svcutil.exe or slsvcutil.exe. Will I lose a lot of time testing this?
By the way, Fiddler does not give much information accept a 500 error code.
It seems that many developers have the same problem themselves but I do not know where to aim! Anybody have a clue?
Here are the specs:
Local machine: Windows XP,
Browser: IE8 with Silverlight
Server Machine: Windows 2003 with IIS 6, .NET 4.0 and WFC RIA installed.
The following link may be of some help
WCF RIA Services - “Not Found” Error Message
We currently have a Silverlight application which is hosted in a SharePoint 2010 page. The Silverlight app makes web service calls to a another server on our domain, which has a clientaccesspolicy file in place. We are experiencing cross-domain issues in our production environment.
Users in the farm admin group can use the Silverlight application without any issues. However, all other users recieve the generic cross domain exception when they try to use this app. We have attached Fiddler to the process and noticed that the farm admins are served the clientaccesspolicy file, but that non-admin users are not. In fact, Fiddler does not ever show an attempt to load this file for non-admins.
This only happens in our production environment, which leads me to believe there is a web config or permission setting causing the issue. Unfortunately, I cannot find anything that backs this up.
Has anyone else run into this issue or know if such a setting exists?
See comments above. I had to change the URL to use the full machine name i.e. from webserver/service.svc to webserver.domain.com/service.svc. It solved the problem but doesn't answer the question about why the farm admins could access it. vorrtex's response is the best possible explanation I have seen so far.
I am accessing Sharepoint web services from a Silverlight application, I have put the clientaccesspolicy.xml file in the root of my Sharepoint site, so I can access fine.
What I would like to do though is hard code the user credentials so the web service always connects with the same user.
Is this possible and if so how?
Thanks in advance.
After emailing Tim Heuer, I was informed that is not possible in SL3, but will be in SL4!
I've recently ran into similar case where I need to pass a specific credential to the generated web service client proxy in Silverlight 4 OOB. For whatever reason I am still getting prompted for authentication so, I'm not sure if it's there in SL4.
What I know possible in SL4 is you can force an HttpRequest to use a ClientHttp stack instead of the WebBrowser one. I've used this with SharePoint 2010 OData feed (_vti_bin/listdata.svc) before successfully, but to access SharePoint Web Services (for example: _vti_bin/lists.asmx), it's a different story.
I finally decided to create my own workaround (specific to SL OOB w/ Elevated Privilege) for this that should work on SL3 OOB and SL4 OOB with elevated privilege. Basically creating my own SharePoint Web Service proxy using the ClientHttp stack and composing and passing my own SOAP message manually using WebRequest.
I blogged about how to do this here.