Cannot create a WCF WebService using SharePoint - c#

I have the following problem:
I'm trying to create a WCF WebService to retrieve information about SPWeb and SPSite within SharePoint 2010. But... it doesn't work, because it tolds me that I'm using the bad .NET framework but I'm actually using the 3.5 (obviously SharePoint only works with .NET 3.5 framework for the time being).
I got the following exception message :
Microsoft SharePoint is not supported with version 4.0.30319.269 of the Microsoft .Net Runtime
Here are some pictures describing my issue:

Have you checked the .Net Version that the App Pool is configured to use?

It is possibly that you have changed .NET framework, build solution and try to debug it within Visual Studio without deploying solution to the farm. I don't know, if I'm not right, correct me. But if you do so, it could be a reason, that you haven't your solution redeployed to the SharePoint farm. So your assembly wasn't deployed to the GAC. Notice, if you didn't deployed solution, you have old DLL in GAC, Visual Studion when you debug solution looks firstly to the GAC, and after that to the local DLLs. So it is possible that you have old version of DLL in the GAC.

I've run into this error before -- verify that all of your project's references are targeting .Net 3.5. I'm not sure it would be a problem with the app pool as #Matt-Klepeis suggests or SharePoint wouldn't start at all.

I thought when working with Sharepoint outside the object model you had to explicitly target an x64 CPU (in advanced compile options, assuming you are using Visual Studio)
Have you tried this?

Related

C# Application Executable will not run on any other device

I have devoloped a C# Application to search a certain directory, read in any files containing a certain string, and then compare those to a database and do various things with said information. I need to upload the project\exectuable to another machine where it will contantly run on a timer, however Every time I try to open the exectuable on any other device I get the windows error, the GradeUpdate (my project name) has stopped working. I created the project in Visual Studio 2013, and only have a few references out of the ordinary which are as follow, and I made sure these references are in my release folder that I copy over to the device which I need the program to run on.
MySqlData.dll
MySqlWeb.dll
I recreated the project from scratch thinking it may be a naming issue, but this did not make a difference. In addition a C# application written in Studio 2010 works on the machine that I am trying to access, however the 2013 application I wrote does not. I believe there may be some local file not included in the project folder that it access's on my local computer, but that is my best guess, any and all suggestions would be very welcome!
Could it be that the machine doesn't have the version of the .NET runtime you're targeting? If you're using Visual Studio 2013, your app may be targeting .NET 4.5. Can you make sure the target machine has the .NET 4.5 runtime installed?
the infamous works on the machine this is a common mistake that beginners make when learning to code.. just because it works on your machine will not guarantee that it will work on others I would first look at the properties of the .dll / assemblies and make sure that you have the CopyLocal property for the dll's set to true make sure that not only are you adding the assemblies in the using header section, but manually adding them to the reference node.. also make sure that the target machine has the same .net framework installed on their machine.

System.Reflection.ReflectionTypeLoadException with Entity Framework 4

I am using EF4 in windows form app. I got a problem whenever I run a release file in machine which doesn't have visual studio 2010 installed I always got this error :
System.Reflection.ReflectionTypeLoadException: Unable to load one or
more of the requested types. Retrieve the LoaderExceptions property
for more information
So far, the only workaround is install VS 2010 and rebuild solution in order to make the release run. It's so annoying, I wonder if there is a better solution.
assuming you have the correct client profile installed on the client machine you might have dependencies to frameworks that are not in the base installation and need to be included as part of your deployment to the client.
You can quickly verify by selecting all the referenced dlls and setting Copy Local=True
And testing everything in the bin on a client machine.
maybe on machine without VS is not installed framework 4.0? or in "target framework" on settings project set "full framework", but must set "client framework 4.0 or 3.5".
sorry for my bad English.
Sorry, just remove the "buildProviders" block. It will probably work =)

Deploy a program that includes Microsoft.Smartdevice.Connectivity assembly

I am using Microsoft.Smartdevice.Connectivity assembly as a part of a larger application. Now I have to deploy that application and I can't find any info in regarding to deploying such applications. Even on the msdn resource page there is a question regarding this issue, with no replys.
So how can I deploy such an application. Is there a list of assemblys I have to deploy or something?
I have included the Misrosoft.Smartdevice.Connectivity.dll however the application is still missing at least one file: "Microsoft.VisualStudio.Connectivity.Interop.dll" I can't find that file anywhere. How can I deploy this application on a machine without visual studio installed.
How can I deploy the application on a computer without visual studio? Is there a SmartDevice Connectivity API redistributable or something?
Thank you for your help.
There is a tool called IsoStoreSpy.application. You can use it to deploy applications.
Good luck
This is a very old question but these libraries are in the NuGet package managerment framework which should allow you to include references. Set the project's build to copy all package-managed DLLs into the output directory of your executable.
http://www.nuget.org/packages/Smartdevice.Connectivity/

.net c# Winforms .exe wont start on any other machine

Ive developed a winforms application on my local machine using .net 4.0 and it runs fine. I have all dotnet versions installed.
When I copied the .exe and all of its references (the complete bin\debug and bin\release) to another machine it simply does not run. On one of my VMS it fires up visual studio express and asks if I want to connect a debgger. On other machines it just doesnt do anything.
But I can work out what on earth is going on.
I have referenced soem xceed dlls that are installed in GAC but not on the target machines GAC could this be the problem?
How do I tell what the hell is going on?
Pete
Yes, the xceed dlls (and every other referenced dlls) must exist on the target machine -- either included in the application directory or the GAC.
You may try specifying "Copy Local = true" to the suspect references, and rebuilding your project, so that these dlls are specifically included with the compiled assemblies.
if you deploy the pdb-files to the one VM with VS Express installed you should be able to connect the debugger and see the exception details. And yes, a missing assembly can (or better: will) cause that kind of behavior if the assembly is not only referenced but actually used in your application. I would generally recommend to implement some kind of error logging (either to the event logs or to a text file).
Have you checked that the other machine has a version of the .Net Framework installed? Failing that try to publish the application using the ClickOnce tool.
ClickOnce will download and instal any missing dependencies for the .Net Framework if necessary.

Web site reports xxx does not exist in current context after upgrade to VS2008 Sp1

I just upgraded to VS2008 Sp1, and I have a weird issue going on. I get a lot of errors from my code behind pages indicating that a control doesn't exist in the current context and I am also getting an errors that the pages do not have methods.
It seems like ide is trying to compile the c# code without compiling the aspx code.
The site runs fine via both IIS and Visual Web Developer, and in fact when I open up the code behind page, all the errors go away. Anyone have any idea why VS2008 SP1 is behaving this way?
I am using C#, and the Web Site project mode.
Check to make sure you are targeting the correct version of the .NET Framework. You can view this in the properties of the Solution file.
VS2008 allows you to target multiple framework versions.
Also check the Web.config, I know there can be differences between VS Web Developer and VS Standard/Pro with the web config. Maybe copy a fresh web.config file into the project.
There is a KB Article and Hotfix for what sounds like might be my issue. I'll test this and update my answer if it was my specific problem but the behavior matches. I need to improve my google skills..should have found this via google.
This patch resolved my issue, weird

Categories