Error Type Not loading when building custom web services in SharePoint 2007
If you have followed the steps in the MSDN article http://msdn2.microsoft.com/en-us/library/ms464040.aspx or used the blog post http://blogs.ittoolbox.com/km/sharepoint/archives/creating-a-custom-web-service-for-sharepoint-13553 you may have run into an error that looked like the follow:
Could not load type 'DevCow.SharePoint.WebServices.HelloBrendon' from assembly 'DevCow.SharePoint.WebServices, Version=1.0.0.0, Culture=neutral, PublicKeyToken=bf7fa58d7195484e'
You might find it strange that nothing is in the eventlog or the SharePoint log, so for a new person or even skilled person this would give them no idea of what to change.
There could be a couple of reasons.
- The class might not be in the assembly. To fix this just add the right reference to the class.
- I couldn't find the real problem, sorry there is no magic fix yet.
Here is what I did to fix number 2
- I added this the AssemblyInfo.cs file
using System.Security;
[assembly: AllowPartiallyTrustedCallers()]
- Rebuilt the Class file.
- Ran IISReset.
- Redeployed my files to the server.
- Navigated to the file http://sharepoint.devcow.com/_layouts/DevCowSampleWebService.asmx
- Removed the added code from AssemblyInfo.cs
- Rebuilt the Class file
- Ran IISReset.
- Redeployed my files to the server
- Navigated to the file http://sharepoint.devcow.com/_layouts/DevCowSampleWebService.asmx and it still worked.
I am sorry that I don't have more helpful information for this problem, I know it can be frustrating if you do have the error.
Now I am having trouble recreating the problem, but I know I saw it. If you are having trouble please email me to try to figure this problem out.