Hi Friends,
I am using an web service, which works in development server in our concern but not works in quality server. The sample code is as follows. In quality server the asmx file is not able to called by the aspx page, it say an error web service call failed 500. While running the asmx directly it runs in quality also but the aspx unable to call the asmx. In which way i need to concentrate on this issue. Kindly look into this and find an solution for me. The aspx and asmx is in same folder which named as CostEstimation
Aspx Page:
<asp:LinkButton ID="linkmaterial" runat="server" Text="View Details" onmousover="$find('Hello').showPopup()">
</asp:LinkButton>
<cc1:PopupControlExtender ID="PopupControlExtender1" runat="server" PopupControlID="Panel4" BehaviorID="Hello"
TargetControlID="linkmaterial" DynamicContextKey='<%# (DataBinder.Eval(Container.DataItem, "TMED_JOB_PR_CODE")) %>'
DynamicControlID="Panel4" DynamicServicePath="~/UI/CostEstimation/PMPMaterialDetails.asmx" DynamicServiceMethod="GetDynamicContent3"
Position="Bottom">
</cc1:PopupControlExtender>
Asmx file:
<%@ WebService Language="C#" CodeBehind="~/App_Code/PMPMaterialDetails.cs" Class="PMPMaterialDetails" %>
Web Service: Floder Path(App_Code/PMPMaterialDetails.cs)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Data.SqlClient;
using System.Configuration;
using LNTADO;
using System.IO;
using System.Data;
using System.Text;
/// <summary>
/// Summary description for PMPMaterialDetails
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.Web.Script.Services.ScriptService]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class PMPMaterialDetails : System.Web.Services.WebService
{
public PMPMaterialDetails()
{
}
[System.Web.Services.WebMethodAttribute(),
System.Web.Script.Services.ScriptMethodAttribute()]
public string GetDynamicContent3(string contextKey)
{
try
{
string[] arr = contextKey.Split('-');
string custommgcode = arr[0].ToString();
string jobcode = arr[1].ToString();
string strconn = ConfigurationManager.AppSettings["DBPMPConn"];
SqlConnection con = new SqlConnection(strconn);
SqlCommand cmd = new SqlCommand("[SQLPMP].[LNTSP_PMP_T_NonComposite_Custom_Material_Group_ToolTip]");
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@Custom_MG_Code", custommgcode);
cmd.Parameters.Add("@Job_Code", jobcode);
cmd.Connection = con;
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable table = new DataTable();
da.Fill(table);
StringBuilder b = new StringBuilder();
b.Append("<table border='1' style='background-color:#f3f3f3;border: #336699 3px solid; ");
b.Append("width:45%; font-size:10pt; font-family:Verdana;' cellspacing='0' cellpadding='1'>");
b.Append("<tr style='background-color:#1C5E55;color:White;font-family:Verdana;font-size:11px;'><td rowspan='1' align='center' style='width:60%;'><b>Materials</b></td>");
b.Append("</tr>");
for (int i = 0; i < table.Rows.Count; i++)
{
b.Append("<tr>");
b.Append("<td align='center'>" + table.Rows[i]["MCMG_Description"].ToString() + "</td>");
b.Append("</tr>");
}
b.Append("</table>");
return b.ToString();
}
catch (Exception ex)
{
throw ex;
}
}
}
Kindly found an solution for me and how i need to concenctrate on this soultion.