Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8044205
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:09:14+00:00 2026-06-05T05:09:14+00:00

When I add my WebService I started getting all these errors: ‘Stream’ is an

  • 0

When I add my WebService I started getting all these errors:

‘Stream’ is an ambiguous reference between ‘System.IO.Stream’ and ‘MultiSelectFileUploader.ServiceReference.Stream’

This wasn’t happening when all I had in there was the GetFiles(). And I can go ahead and change my Streams to System.IO.Stream, but then I get the error that it isn’t a ServiceReference.Stream when I try to pass to the UploadFiles(). Thanks for the assitance.

Here’s my WebService…

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);
        }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T05:09:16+00:00Added an answer on June 5, 2026 at 5:09 am

    Streaming is not supported in ASMX services. You have to use WCF.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When should we add this attribute to an asp.net webservice ? [System.ComponentModel.ToolboxItem(false)]
I'm trying to consume a webservice and while trying to add a web reference
I created webservice which contain Add function as 'webmethod' when we want to deploy
I've started learning the Apache CXF with Spring. First of all, I've tried to
I've consumed web services before (add reference > advanced > web reference). However, this
I have a webservice that exposes a function called ADD(int a, int b) and
How can I add <%@ webservice class=MyNamespace.MyClass ... %> To the top of a
i've got the following simple webservice : [WebMethod()] public int Add(int a) { return
Can we add webservice(.asmx) to window application.When i go through File->New Project-> i cant
I'm trying to consume one HTTPS webservice in Adobe Flash Builder. when I add

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.