1
ASP DynamicPopulateExtender에서 웹 서비스를 호출하고 있지만 웹 서비스를 찾지 못하는 것처럼 "웹 서비스 호출 실패 : 0"오류가 발생하는 것 같습니다. 오류 코드 0이 적용되는 다른 이유가 있습니까?DynamicPopulateExtender에서 호출 할 때 "웹 서비스 호출에 실패했습니다. 0"
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
<h1>Stock Updates</h1>
<asp:Panel ID="upExtenderContent" runat="server" CssClass="dynamicPopulate_Normal">
Stock file import has STARTED please wait....<br /><br />
<asp:Image ID="imgLoading" runat="server" ImageUrl="~/admin/adminimages/uploading.gif" />
</asp:Panel>
<asp:DynamicPopulateExtender ID="dpeAjaxImport" runat="server"
TargetControlID="upExtenderContent"
BehaviorID="dp1"
ClearContentsDuringUpdate="false"
ServiceMethod="importStock"
ServicePath="importFile.asmx"
ContextKey="none"
PopulateTriggerControlID="btnImport">
</asp:DynamicPopulateExtender>
<br />
<asp:Button ID="btnImport" runat="server" OnClick="importFile" Text="Upload" />
<script type="text/javascript">
function uploadData(value) {
var behavior = $find('dp1');
if (behavior) {
behavior.populate(value);
}
}
Sys.Application.add_load(function() { uploadData('c:/Ben_Saved_Small.csv'); });
</script>
importFile.asmx 파일 서비스가 그렇게 쉽게 찾을 수 있어야 위의에서 .aspx 파일과 같은 디렉토리에 상주 :
<%@ WebService Language="C#" CodeBehind="importFile.asmx.cs" Class="GG.co.uk.admin.importFile" %>
다음
는 .ASPX 파일입니다
이 파일 헤더는 다음 파일 내용을 참조합니다.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Script.Services;
using System.Web.Services;
using System.Text;
using System.IO;
using GG.co.uk.App_Code;
using GGDAL;
namespace GG.co.uk.admin
{
/// <summary>
/// Summary description for importFile
/// </summary>
[WebService(Namespace = "http://GG.co.uk.admin/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
[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 importFile : System.Web.Services.WebService
{
[WebMethod]
public static string importStock(string contextKey)
{
string returnResponse="";
//Load data into website database
try
{
//Read and process files
}
catch (Exception ex)
{
returnResponse = returnResponse + "<span style=\"color:red;font-weight:bold;\">Uh-Oh! " + ex.Message + "</span> : " + contextKey;
}
return returnResponse + "<br />";
}
}
}
ould 정말 도움이 될 것입니다.
감사합니다.
이있어 시도
제거를하지 않습니다! 마지막으로 호출이 끝난 것처럼 보였지만 서비스가 계속 실행 중이므로 후속 호출에서 "failed : 0"이 반환되었습니다. –