Thursday, November 10, 2011

How to Fix Error "The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047" that deploy Customer Web Service in Sharepoint 2010

i try to follow Rob Windsor's Blog Posting to create a Custom Web Service in Sharepoint 2010.
 Walkthrough: Creating a Custom ASP.NET (ASMX) Web Service in SharePoint 2010

it looks straight Forward. since the configuration is quite simple. I was with the following erorr.

Parser Error Message: The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)

Source Error:


Line 1:  <%@ WebService CodeBehind="MyCustomWebService.asmx.cs" Class="WebServiceDemo.MyCustomWebService, Version=1.0.0.0, Culture=Neutral, PublicKeyToken=85b819cd95d3fe73" %>



when i google with the Error message. some solutio suggest that we should modify the trust level to be Full
this is a very risky approach to fix an issue.  fortunately this is a solution. the root cause of this issue sterm from missing an element from the strong name of web service class. After i properly set the strong name of WebService Class. the web service link render successfully

the format of the strong name of web service class is


Class="ClassName with full path, Assembly Name, Version, Culture,  PublicKeyToken"

 here is specific for my web service.

<%@ WebService CodeBehind="MyCustomWebService.asmx.cs" Class="WebServiceDemo.MyCustomWebService,WebServiceDemo, Version=1.0.0.0, Culture=Neutral, PublicKeyToken=85b819cd95d3fe73" %>

5 comments:

  1. It was the same problem for me. I followed the article and thought the ClassName and Assembly Name were one in the same. So I removed the Assembly Name.

    I added in back and now it works!

    ReplyDelete
  2. I aslo faced same problem in site core. How to find and solve issue? can tel any one

    ReplyDelete
    Replies
    1. as i mention in my blog, you should use the strong name of the class. you will find in the configuration file(either web.config or app.config, it depends on how you consume your web service

      Delete
  3. Wow, What an Outstanding post. I found this too much informatics. It is what I was seeking for. I would like to recommend you that please keep sharing such type of info.If possible, Thanks. visit site

    ReplyDelete