dimanche 11 janvier 2015

Custom ASMX Could not create type



I was trying to add my own WebService/asmx to SharePoint 2013.


and I got this wonderful error message



Sorry, something went wrong

An error occurred during the processing of /_layouts/MyFolder/MyWS.asmx. Could not create type 'MyNamespace.MyClassName'.


Technical Details


Troubleshoot issues with Microsoft SharePoint Foundation.


Correlation ID: 93a3de9c-2213-3030-a6c5-f324a2c11743


Date and Time: 1/11/2015 10:11:35 AM



BTW, it was working on SharePoint 2007 with the same method which I've also seen to be working here:



  1. I've compiled my WebService Against .Net 4.0 (AnyCpu) to get MSIL DLL file.

  2. Copied the files to SharePoint machine


  3. Installed to GAC by using this:


    C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools\x64\gacutil.exe -I MyDllName.dll




  4. Tested that the Dll were successfully installed by using this:


    C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools\x64\gacutil.exe -L MyDllName.dll




  5. I've also tried to write text-only asmx to test the GAC:





<%@ WebService language="C#" class="TestMyAssembly" %>



using System;
using System.Reflection;
using System.Web.Services;
using System.Xml.Serialization;

[WebService(Namespace = "http://test.com/Test")]
public class TestMyAssembly : WebService
{
[WebMethod]
public String TestAssembly()
{

Assembly assembly1 = Assembly.Load("FullAssemblyName1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=118db1178ce8ee11, processorArchitecture=MSIL");


Assembly assembly2 = Assembly.Load("FullAssemblyName2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=22e5225e223b2240, processorArchitecture=MSIL");

if (assembly1 != null && assembly2 != null)
{
return "No exception so far...";
}

return "Something is wrong";
}
}


Any help would be greatly appreciated. thanks!








0 commentaires:

Enregistrer un commentaire