나는이 모든 오류를 받기 시작했다 나는 거기에있는 모든 것이 GetFiles() 일 때 일어난다. 그리고 계속 진행하여 Streams를 System.IO.Stream으로 변경할 수 있지만 UploadFiles()에 전달하려고 시도하면 ServiceReference.Stream이 아니라는 오류가 발생합니다. assitance에 감사드립니다.Silverlight (3.0)에 WebService를 추가 할 때 모호한 참조가 있습니까? 'System.IO.Stream'와 'MultiSelectFileUploader.ServiceReference.Stream'</strong></p> <p>이 '년후 사이의 모호한 참조입니다</p> <p><strong>'스트림 '내 WebService를 추가 할 때
다음은 별도의 어셈블리 (DLL을) 두 네임 스페이스 스트림라는 두 개의 클래스를,이 같은
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.IO;
namespace MultiSelectFileUploader.Web
{
/// <summary>
/// Summary description for FileService
/// </summary>
[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 FileService : System.Web.Services.WebService
{
[WebMethod]
public List<string> GetFiles()
{
List<string> l = new List<string>();
foreach (FileInfo fi in (new DirectoryInfo(Server.MapPath("~/Temp/")).GetFiles()))
l.Add(fi.Name);
return l;
}
[WebMethod]
public void UploadFiles(string filename, Stream file)
{
string filepath = AppDomain.CurrentDomain.BaseDirectory + @"Temp\";
if (!Directory.Exists(filepath)) { Directory.CreateDirectory(filepath); }
WriteFile(file, File.Create(Context.Server.MapPath("~/Temp/" + filename)));
}
private void WriteFile(Stream stream, FileStream fs)
{
int bytesRead;
byte[] buffer = new byte[4096];
while ((bytesRead = stream.Read(buffer, 0, buffer.Length)) != 0)
fs.Write(buffer, 0, bytesRead);
}
}
}
당신은 자신의'Stream' 클래스가 있습니까? –
아니, 음, 목적이 아닙니다. 내 xaml.cs에서 ServiceReference.Stream을 할 수는 있지만 직접하지는 않습니다. (필자는 UploadFiles()로 전달하는 매개 변수에서 Stream을 참조했기 때문에 어떻게 든 거기에 놓여 있다고 생각합니다.) – Ber53rker