asif iqbal

asif iqbal

  • NA
  • 3
  • 1.6k

Assembly doesnot have a strong name error

Aug 24 2012 8:20 AM

Assembly does not have a strong name error occured while using  [Automatic] Transaction inside class method, Consuming Web service method(handling transaction)

The assembly 'C:\Users\asif.s\AppData\Local\Temp\Temporary ASP.NET Files\testapplication_10aug2012\7a96f4fa\38e2018e\App_Code.pmfte3ms.dll' does not have a strong name.


//Web Service Code
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.Xml;
using System.ComponentModel;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.Xml.Serialization;
using System.EnterpriseServices;

[WebService(Namespace = "http://tempuri.org/")]
  [WebServiceBinding(ConformsTo = WsiProfiles.None)]
 public class WebServiceDBAccess : System.Web.Services.WebService
  { 
[WebMethod(MessageName = "ExecuteNonQuery", Description = "Inserts and Updates Records", EnableSession = true, TransactionOption = TransactionOption.RequiresNew)]
  public string ExecuteNonQuery(string sql)
  {
 System.Configuration.ConfigurationSettings.AppSettings["connectionString"];
 SqlConnection sqlConnection = new SqlConnection(_connectionstring);
  sqlConnection.Open();
  try
  {
  SqlCommand command = new SqlCommand(sql, sqlConnection);
 command.CommandType = CommandType.Text;
  command.ExecuteNonQuery();
  return "Succeeded";
  }
  catch
  {
  throw;
  }
  finally
  {
  if (sqlConnection.State == ConnectionState.Open)
  {
  sqlConnection.Close();
  }
  }
  }}

//Application code consuming web service
public partial class _Default : System.Web.UI.Page
{
 
  UtilityClsProgm objClass1 = new UtilityClsProgm();
  protected void Page_Load(object sender, EventArgs e)
  {
  WebReference.WebServiceDBAccess service1 = new WebReference.WebServiceDBAccess();
  string status = service1.SetConnectionString("server=192.168.0.1; user id=sa; pwd=xyz; initial catalog=Test");
  objClass1.doTrans(service1);
 
  }}

//AppCode Class
using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.EnterpriseServices;
[Transaction(TransactionOption.Required)]
public class UtilityClsProgm : ServicedComponent
{
  public UtilityClsProgm()
 {
 }

  [AutoComplete]
  public void doTrans(WebReference.WebServiceDBAccess service)
  {
  try
  {
  string strStatus = service.ExecuteNonQuery("insert into empmaster values('Ajay')");
  string strStatus2 = service.ExecuteNonQuery("insert into empmaster values('Salman')");
  //ContextUtil.SetComplete();
  }
  catch
  {
  //ContextUtil.SetAbort();
  }
  }
}