I need to create asp.net website (on windows), the website should be installed on a windows computer. The website (installed on windows OS) should be able to control the raspberry pi pins(with raspbian OS installed). I don't know how and where could I start! any hint would be so appreciated.
i dont know windows iot how can help you for this! but if you wann use python and raspbian(or another linux distro) you can create rest api and call this api from your asp.net website to control your rapberry pi by parsing rest api in .net for creating this api you can use flask or another python framework you have a wide choice for your programming language in linux such as python, go, nodejs ,even php ,... and any of them can help you to build your own Rest-api
As indicated by @goldilocks this is a very wide open question, to answer properly much more details are needed.
Like on every small or large project, divide it into development units, each one with it's own testing methods then, connect the pieces together. Think LEGO: you will write some pieces, others you will integrate.
You want to control GPIO pins from another system (ASP.NET IIS web site): Why not locally on the RPi Apache using PHP/Python? There are some examples elsewhere. Will assume the IIS have public access and RPi is on you intranet.
You then need to define a protocol to connect both devices: this can be your own creation or a complex REST/SOAP standard.
Do you need to obtain status from the RPi to show on you ASP.NET page? If yes, the you need to have a method to remote query the RPi from Windows.
The following draft is a very simple protocol, that allows you to send and receive low data volume, allowing the RPi to be local or on the other side of the world, making it a truly IOT.
In a loop, as fast as your requirement, from a few second to hours, the RPi send status to your IIS, posting a web query (using wget) and receiving back data from your server:
wget http://<YourIISServer>/xxx.aspx?status="<RpiStatus>" -o /dev/null -O /tmp/xxx
You then read and parse the
/tmp/xxx data received: if you are brave enough, your data can be a bash script to be executed on your RPi.
Will leave the ASP
xxx.aspx details for you, just process the form query "status" (data from RPi to Server) and send a reply with your RPi instructions:
To send your data from IIS, on the ASP.NET page Init event add the following (assuming VB.Net):
Response.Clear() Response.Write("<your instruction message to RPi>") Response.End()
On your ASP.NET app, you store the RPi instructions elsewhere and you send them back when the RPi poll the server. You can use a simple SQL table to keep track of it.
This is not real time, a very asynchronous process but effective a easy to implement.
I do not know what a asp.net website is that you mention in your question's original post, but in the comments section, you describe
"...a simple project just lighting a led on or off from internet..."
I've just spent the day installing a RPi project which is based on just that. After considering many approaches, I finally settled on using Python to write an extremely simple server-client relation (between a desktop PC at home and a RPi at work) using "sockets". I did a good deal of reading, like articles, tutorials, forums, documentation, knowledge bases, retail site's "learn" pages etc. and found PySocks to be the best all-around.
If you just want the essentials (in Python 2.7) for a jumping off point:
(THIS IS THE BARE MINIMUM FOR YOUR SOCKET SERVER - I chose to use UDP instead of TCP because it used less code! This is an echo server - anything it receives from the CLIENT is promptly echoed back)
import socket dgramSock = socket.socket( socket.AF_INET, socket.SOCK_DGRAM ) dgramSock.bind( ('', port number) ) <--- please note: two single quotes, NOT one double quote (body) incomingMessage, (addr, port) = dgramSock.recvfrom(bufferSIZE) dgramSock.sendto(incomingMESSAGE, (addr, port)) (NOW FOR THE SOCKET CLIENT) (set up) import socket dgramSock = socket.socket( socket.AF_INET, socket.SOCK_DGRAM ) (body) dgramSock.sendto( message2send, (addr, port number) )
But really, check out the link I gave, it's really very good. I have tested all my code on my LAN here at home and it all works properly. Haven't tested yet over the WAN that separates my home and work, but I'm assured that SOCKETS are real working things actually used on THE internet. Yes, I'm really quite the NOOB, but I can really relate to the way your post went, and how perplexing starting from a dead stop with nothing to push off against can be (or, in my case, ALWAYS IS). And you gotta love those members who have to chime in with their sarcastic comments; they're SOOO helpful.