저는 C# 버전 4.0을 사용하여 웹 서비스 (ASMX)를 개발했습니다. 파일을 우리 웹 서버에 업로드합니다. 웹 서비스를 배포 한 후 .net v4.0을 사용하여 win 양식 프로젝트를 만들고 여기에 웹 서비스의 프록시를 만듭니다. 그 후 파일 업로드 프로세스를 테스트하고 작동하는 것으로 나타났습니다. .net v2.0을 사용하여 win 양식 응용 프로그램을 만들 때 문제가 시작되고 동일한 웹 서비스의 프록시를 만들 때 Reference.cs 파일없이 프록시를 만들었습니다. 그 이유는 그 웹 서비스를 호출 할 수 없습니다. 내가 dotnet 버전 2.0을 사용하여 프록시를 만들려고 할 때 Reference.cs 파일이 만들어지지 않은 이유를 이해할 수 없다.웹 서비스 (ASMX) 프록시 생성 및 reference.cs 파일이 생성되지 않습니다.
그래서 특정 버전이 있는지 알려주세요. 문제는 dotnet v2.0에서이 웹 서비스를 개발하고 dotnet v2.0에서 만든 프록시 때문에 발생합니다. Reference.cs 파일이 생성되지 않은 이유를 설명하십시오. 또한 내가 어떻게이 문제를 해결할 수 있는지 안내 해준다.
여기 웹 서비스 코드를 게시하고 있습니다. 외모가 있고 나에게 잘못된 것이 있다는 것을 말해줘.
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// 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 FileUploader : System.Web.Services.WebService
{
[WebMethod]
public string UploadFile(byte[] f, string fileName)
{
// the byte array argument contains the content of the file
// the string argument contains the name and extension
// of the file passed in the byte array
string uploadFolder = HttpContext.Current.Request.PhysicalApplicationPath + @"UPS_New\LabelImages\" + fileName;
try
{
// instance a memory stream and pass the
// byte array to its constructor
MemoryStream ms = new MemoryStream(f);
// instance a filestream pointing to the
// storage folder, use the original file name
// to name the resulting file
FileStream fs = new FileStream(uploadFolder, FileMode.Create);
// write the memory stream containing the original
// file as a byte array to the filestream
ms.WriteTo(fs);
// clean up
ms.Close();
fs.Close();
fs.Dispose();
// return OK if we made it this far
return "OK";
}
catch (Exception ex)
{
// return the error message if the operation fails
return ex.Message.ToString();
}
}
}
나를 안내하십시오 ... 나는 제안을 찾고 있습니다. 덕분에
이 문제를 해결할 수 있습니다 .i wsdl.exe를 사용하여 해당 서비스의 프록시를 만든 다음 .net v2.0을 사용하여 개발 한 winform 응용 프로그램에서이 프록시 클래스를 사용합니다. 이제는 reference.cs없이 모든 것이 잘 작동하고 있습니다. 파일. – Thomas