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

  • SEARCH
  • Home
  • 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 7845079
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T17:06:32+00:00 2026-06-02T17:06:32+00:00

I am developing a WPF application. As part of the application, I need to

  • 0

I am developing a WPF application. As part of the application, I need to receive some images via another iOS application. And so I’ve written both WCF REST service and the iOS and I am able to send the images to the web service only when I define the service as part of IIS.

What I need to be happening is: When the WPF application is started, the web service will also be started as well, and expose a port number for the iOS device to send images and “wake” the WPF application when started.
Any thoughts?

  • 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-02T17:06:33+00:00Added an answer on June 2, 2026 at 5:06 pm

    Yes I did. Actually as Tim mentioned, that exactly what I did self-hosting service.
    You can take a look at the following video (there are plenty of other, have a look at the links).
    http://channel9.msdn.com/shows/Endpoint/endpointtv-Screencast-Building-RESTful-Services-with-WCF/

    Here are the complete files in my WCF project: (as mention in the movie), I hope it will get you started..
    Just note that it is also important to open a specific port in you machine to enable incoming HTTP traffic. Have a look at WCF ServiceHost access rights.

    Eval.cs

    [DataContract]
    public class Eval
    {
        public string id;
    
        [DataMember]
        public string Submitter;
        [DataMember]
        public DateTime Timesent;
        [DataMember]
        public string Comments;
    }
    

    IEvalService.cs

    [ServiceContract]
    public interface IEvalService
    {
        [WebInvoke(Method="POST", UriTemplate = "evals")]
        [OperationContract]
        void SubmitEval(Eval i_Eval);
    
        [WebGet(UriTemplate = "evals")]
        [OperationContract]
        List<Eval> GetEvals();
    
        [WebGet(UriTemplate="eval/{i_Id}")]
        [OperationContract]
        Eval GetEval(string i_Id);
    
        [WebGet(UriTemplate = "evals/{i_Submitter}")]
        [OperationContract]
        List<Eval> GetEvalsBySubmitters(string i_Submitter);
    
        [WebInvoke(Method = "DELETE", UriTemplate = "eval/{i_Id}")]
        [OperationContract]
        void RemoveEval(string i_Id);
    
        [WebGet(UriTemplate = "GetLastPhoto", BodyStyle = WebMessageBodyStyle.Bare)]
        Stream GetLastPhoto();
    
        [OperationContract] // this web address is for receiving the image for the iOS app.
        [WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Bare, UriTemplate = "TestPost")]
        string TestPost(Stream stream);
    }
    

    EvalService.cs

    [ServiceBehavior(InstanceContextMode=InstanceContextMode.Single)]
    public class EvalService : IEvalService
    {
        private List<Eval> m_Evals = new List<Eval>();
        private int evalCount = 0;
        private string k_FilePath = "C:\\ImageUpload\\";
    
        public static event Action<LogicImage> ImageLoaded;
    
        public void SubmitEval(Eval i_Eval)
        {
            i_Eval.id = (++evalCount).ToString();
            m_Evals.Add(i_Eval);
        }
    
        public List<Eval> GetEvals()
        {
            return m_Evals;
        }
    
        public Eval GetEval(string i_Id)
        {
            return m_Evals.First(e => e.id.Equals(i_Id));
        }
    
        public List<Eval> GetEvalsBySubmitters(string i_Submitter)
        {
            if (i_Submitter == null && i_Submitter.Equals(""))
            {
                return null;
            }
    
            else
            {
                return m_Evals.Where(e => e.Submitter == i_Submitter).ToList();
            }
        }
    
        public void RemoveEval(string i_ID)
        {
            throw new NotImplementedException();
        }
    
        public Stream GetLastPhoto()
        {
            Image image = Image.FromFile("C:\\ImageUpload\\014.png");
            MemoryStream ms = new MemoryStream(imageToByteArray(image));
            return ms;
        }
    
        public string TestPost(Stream stream)
        {
            HttpMultipartParser parser = new HttpMultipartParser(stream, "image");
    
            if (parser.Success)
            {
                if (parser.Success)
                {
                    // deal with exceptions..
                    //
                    File.WriteAllBytes(k_FilePath + parser.Filename, parser.FileContents);
                    if (ImageLoaded != null)
                    {
                        ImageLoaded.Invoke(new LogicImage(){FileName = parser.Filename, Location = k_FilePath});
                    }
                }
            }
    
            return "test";
        }
    
        public static byte[] imageToByteArray(System.Drawing.Image imageIn)
        {
            MemoryStream ms = new MemoryStream();
            imageIn.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
            return ms.ToArray();
        }
    }
    
    public class LogicImage
    {
        public string FileName { get; set; }
        public string Location { get; set; }
    }
    

    And last but not least ** App.config**

    <?xml version="1.0"?>
    <configuration>
    
      <system.web>
        <compilation debug="true"/>
      </system.web>
      <!-- When deploying the service library project, the content of the config file must be added to the host's 
      app.config file. System.Configuration does not support config files for libraries. -->
      <system.serviceModel>
        <services>
          <service name="ImageRecevierWebService.EvalService">
            <host>
              <baseAddresses>
                <add baseAddress="http://localhost:8732/Design_Time_Addresses/ImageRecevierWebService/Service1/"/>
              </baseAddresses>
            </host>
            <!-- Service Endpoints -->
            <!-- Unless fully qualified, address is relative to base address supplied above -->
            <endpoint address="" binding="wsHttpBinding" contract="ImageRecevierWebService.IEvalService">
              <!-- 
                  Upon deployment, the following identity element should be removed or replaced to reflect the 
                  identity under which the deployed service runs.  If removed, WCF will infer an appropriate identity 
                  automatically.
              -->
              <identity>
                <dns value="localhost"/>
              </identity>
            </endpoint>
            <!-- Metadata Endpoints -->
            <!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. --> 
            <!-- This endpoint does not use a secure binding and should be secured or removed before deployment -->
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
          </service>
        </services>
        <behaviors>
          <serviceBehaviors>
            <behavior>
              <!-- To avoid disclosing metadata information, 
              set the value below to false and remove the metadata endpoint above before deployment -->
              <serviceMetadata httpGetEnabled="True"/>
              <!-- To receive exception details in faults for debugging purposes, 
              set the value below to true.  Set to false before deployment 
              to avoid disclosing exception information -->
              <serviceDebug includeExceptionDetailInFaults="False"/>
            </behavior>
          </serviceBehaviors>
        </behaviors>
      </system.serviceModel>
    
    <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing application in WPF but some components are written using WinForms. I wan't
Hi I'm developing a WPF application. I need to display some HTML content from
I am developing a WPF application, and I need your advice. I have to
We are developing a completely standard WPF application with a menu and toolbar. Both
I'm developing a WPF application using the MVVM pattern and I need to display
I'm developing a WPF application, and some guidance would be appreciated. The application needs
I am developing a WPF application where the 3D part is handled by DirectX
I am developing a WPF application where i can read some properties from the
I'm developing a WPF based application that must play some videos during its execution.
I am developing a WPF application in .NET 4.0 which calls a WCF Service

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.