Error IIS and Android - c#

I'm Brazilian, and I apologize for my English, which is very bad
I've been facing a problem for some time, and I'm tired of looking for a solution in Portuguese.
I created a WCF service to be consumed by Android, hosted on a computer that I have at home with Windows server and iis installed, configured all the correct port releases for the application to work on the phone, but it has the following error in the execution: System.Reflection .TargetInvocationException
So I decided to host the WCF service on an external server, I used the number service. I just uploaded the files to it and changed the address references in the application to communicate with the WCF, and then it worked, so I guess some configuration that has to be done in IIS or in Windows itself, I'm waiting for some help. Thank you

Related

How to host WCF web service over the internet?

I work as a C# developer and we have many .NET web services that we use. I am doing some at home development and want to do something similar. I have a database (SQL Server 2012) on a home PC running Windows Server 2012 with IIS 8 installed. I have created a WCF web service in Visual Studio (C#) and it compiles to a .svc file. This just facilitates data exchange between my SQL Server Database and the application I am writing.
I am unfamiliar with how to host the WCF service so that the Windows Form application that I am writing that will be installed on many non-local machines can access it. I figured a WCF service would be the best choice for accessing my database for the WinForm application over the internet.
I also have a domain with a basic Windows package on 1&1.com leftover from a previous project if that helps.
Can anyone give me some steps to get my WCF service hosted so it can be accessed over the internet? Please ask if I forgot to list any needed information.
Two common ways are to host your WCF service from IIS, or to self host it yourself from within a simple wrapper program that acts as a TCP server.
See http://msdn.microsoft.com/en-us/library/ee939285.aspx
The simplest way is to setup IIS and just publish your services like you would a web application; your service will exposed over http/https. Use an appropriate binding like wsHttpBinding or BasicHttpBinding depending on your security needs. Read up to understand the different bindings and what each does and does not support.
In order to host WCF via IIS, at least on Windows Server 2003 and 2008, make sure you follow the install steps, such as adding .NET 3.5.1 / WCF options on older platforms. I believe Server 2012 includes it within .NET 4 framework, but I haven't yet done it on 2012.
Google "WCF hosting IIS" for steps / setup guides.
There are also hosting providers that specifically provide WCF hosting solutions, though I'm pretty sure your current provider, since it supports IIS, should do fine.

Creating a Web Server container to emulate an IIS server

Okay, I'm a very green developer (co-op student) so I'll try my best to make sense. Currently I have a web application (call it "Updater") that is an aspx and runs through IIS. My boss has asked my to look into creating a program (exe or command line) that can run the app through created encapsulated web server that can act like IIS. This is so that I can run the exe during an installer procedure on a client's machine so that the updater can configure the client's program.
So Far I've looked into sources upon sources on how to create a self hosted web server to handle a web app and I've managed to do the following:
-Create a command line server hosted at a given port #######.
-Use a StreamReader to read an html file
-Use HttpResponseMessage to set the Content to this html page.
Obviously this is very rudimentary, but I couldn't understand how to switch the app over to the server I created rather than the IIS.
Any help ont he matter would be appreciated, like I said I'm still quite new.
You can use OWIN to self host from within a console application.
Look for 'Self-Host OWIN in a Console Application' in the following link:
http://www.asp.net/aspnet/overview/owin-and-katana/getting-started-with-owin-and-katana
You need to start you self host server with the address your app is trying to contact. If your IIS is running with the default settings it should be http://localhost:80. Before you start the self host server you need to shut down your IIS website that is running on port 80. Two applications can not listen on the same port at the same time.
What you ask is a redistributable web server for ASP.NET. So, you might find interesting the UltiDev Web Server, formerly known as Cassini web server.
From their website:
UltiDev Web Server Pro (UWS) is an advanced, redistributable web server for Windows that can be use as a regular web server to host web sites and ASP.NET applications, or packaged with your ASP.NET web application and installed on your customers' systems along with your web app or site.

Connecting to WCF Service on the same network

I have a WCF service deployed on IIS7.5 on windows 7. It is using basicHttpBinding since this service is to be consumed through a windows mobile 6.5 application.
If I try to connect from the same machine (192.168.0.201) everything works as it should. However if I try to connect from another machine on the same network, (here's the weird part) It manages to find the service however any successive calls fail.
If I browse to the service's wsdl page from a web browser it responds with "the page cannot be found", although the "you have created a service" page is found!
Note that browsing to wsdl page from the local machine works fine as well.
Can anyone help please ?
Thanks in advance
There is more to it than just the endpoint. Do you have a behavior? It is all in the documentation.
How to: Publish Metadata for a Service Using a Configuration File

Problems with starting windows service on windows xp SP3

I'm currently facing a problem which I can not resolve and I really don't know what to do anymore.
When I'm trying to start the service I receive the message: "The service is started but again also stopped, this because that some of the services will stop if they have nothing to do, for example the performance logs and the alerts service".
I've looked into the Windows Logs but nothing is written there which could describe why my service is all the time stopping. I've also tried to fire the windows service via the command prompt which gives me the message: "The service is not started, but the service didn't return any faults.".
I've tried to remove all keys which references to my service, which didn't resolve the issue.
I've searched on google (maybe not good enough) to find an answer but I didn't found any. I did found some websites which describes what I could do, but all of these suggestions didn't work.
This is kinda ** because I do not know where to look. I do not have any error message, i do not have any id which i can use to search on. I really don't know where to start and I hope you guys can help me on this one.
Detailed explanation about the windows service
OS: Windows XP SP3
.Net Framework: .Net 4.0 Client Profile
Language: C#
Development environment: Visual Studio 2010 Professional (but Visual Studio 2012 RC is installed)
Communications: WCF (Named Pipes), WCF (BasicHTTPBinding)
Named Pipes:
I have chosen for this solution because I wanted to communicate from a windows service to a windows form application. It worked now for quite some time but suddenly my windows service shuts it self down and I couldn't restart it anymore.
There are two named pipes services implemented: An event service which will send any notification to the windows form application and an management service which gives my windows form application the possibility to maintain my windows service.
BasicHTTPBinding:
The basic http binding makes the connection to a central server. This connection is then used for streaming information from the client to the server.
I do not know which additional information you will need, but if you guys need something then I'll try to give it as detailed as possible.
Thank you in advance.
Ok, I have solved the issue and really it is a stupid one. Windows XP will not throw any error or does not report to you that the book where all logs are stored is full!!! After cleaning the log my service started perfectly and keeps running. How stupid! :)

Publishing WebServices and IIS

I'm having problems when publishing services on IIS.
First, I will describe my scenario.
At the moment I have an WPF app in C#.
Also I have a web site (published in IIS through HTTPS) that need to communicate with the c# application, therefore I decide to publish the methods I needed through a REST web service also through https:
WebServiceHost serviceHost = new WebServiceHost(typeof(QESWebService), new Uri("https:xxx/WS/");
When I tested it on Windows 7 there were no problem. Everything works fine.
But now, when I try the application in Windows XP, it is not working! I cannot launch the application because the port 443(for the web service https) is already in use.
I cannot find a solution different to dont use https on one of the sides, but I really need it, What can I do?
Thanks in advance
If you already have a web application/service running on the IIS using SSL then you need to change some configuration settings
Here is an article about Multiple SSL Web Applications on Port 443

Categories