服务器到服务器PopupControlExtender + Web服务 [英] Sever To Server PopupControlExtender + Web Service

查看:95
本文介绍了服务器到服务器PopupControlExtender + Web服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友,

我正在使用Web服务,在我们所关注的情况下,该服务可在开发服务器中使用,而在优质服务器中则无法使用.示例代码如下.在质量服务器中,aspx页面无法调用asmx文件,它说一个错误的Web服务调用失败500.直接运行asmx时,其质量也很高,但是aspx无法调用asmx.我需要以哪种方式专注于这个问题.请对此进行调查,并为我找到解决方案. aspx和asmx在名为CostEstimation
的文件夹中
Aspx页面:

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档案:
<%@ WebService语言="C#" CodeBehind =〜/App_Code/PMPMaterialDetails.cs" Class ="PMPMaterialDetails"%>

Web服务:Floder路径(App_Code/PMPMaterialDetails.cs)



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.

推荐答案

find('Hello').showPopup()" > < /asp:LinkBut​​ton > < cc1:PopupControlExtender ID =" runat 服务器" PopupControlID Panel4" 行为ID 你好" TargetControlID =" linkmaterial" DynamicContextKey &%; span>#(DataBinder.Eval(Container.DataItem," TMED_JOB_PR_CODE"))) DynamicControlID =" Panel4" DynamicServicePath 〜/UI/CostEstimation/PMPMaterialDetails.asmx" DynamicServiceMethod =" 位置 =" 底部" > < /cc1:PopupControlExtender >
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档案:
<%@ WebService语言="C#" CodeBehind =〜/App_Code/PMPMaterialDetails.cs" Class ="PMPMaterialDetails"%>

Web服务:Floder路径(App_Code/PMPMaterialDetails.cs)



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.


这篇关于服务器到服务器PopupControlExtender + Web服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆