简体   繁体   中英

Cannot create a WCF WebService using SharePoint

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:

Web方法

例外

您是否检查了应用程序池配置为使用的.Net版本?

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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM