none
Web service (ASMX) proxy creation and reference.cs file not generating RRS feed

  • Question

  •  I have developed a web service(ASMX) using c# version 4.0. which will just upload file to our web server. after deploying web service i create a win form project using .net v4.0 and there i create the proxy of my web service. after that i test the file upload process and found it is working. the problem start when i create a win form apps using .net v2.0 and when i create a proxy there of same web service then i saw proxy created without Reference.cs file. that is why i am not being able to call that web service. i am not being able to understand why Reference.cs file is not created when i try to create proxy using dotnet version 2.0.

    so just tell me is there version specific issue. i guess problem occur because i develop this web service on dotnet v4.0 and proxy created on dotnet v2.0. please explain why Reference.cs file is not created. also guide me how could i solve this problem.

    here i am posting my web service code. just have a look and tell me is there anything wrong.

     [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();
                }

            }

        }

    please guide me...i am looking for suggestion. thanks
    Friday, February 1, 2013 9:23 AM

Answers

  • Hi,

    Please try with Add Web Reference(which is a wrapper over wsdl.exe and can be used to create proxies for .NET 1.1 or 2.0 clients) for your client. Proxies generated by Add Service Reference can only be consumed by .NET 3.0+ clients.

    If it does not work, please explain your issue more clearly.

    >>I have developed a web service(ASMX) using c# version 4.0

    Which template are you using, I do not find a XML web services template with .net 4.0, there is one(ASP.NET Web Service Application) with .net 3.5.

    Best Regards.


    Haixia
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, February 4, 2013 9:41 AM
    Moderator