Showing posts with label running. Show all posts
Showing posts with label running. Show all posts

Tuesday, March 13, 2012

Talking between two different web servers

I have two different servers (different ip addresses). They are running IIS. They both have access databases. The first server contains a website.

What is the simplest way to use my website to connect to the other server? My goal is to send information to the access database on the other sever. How can they communicate with one another?

Thanks

Hi,

You can create a web service on the second server. Or you can create a second web site on the second server and receive form data from the first server.


Thanks.

How can I receive data from the second server by receiving form data from the first server? Would I have to set up connection strings specifying both servers? Both servers are located in different regions and not on the same local network. For it to be possible, their IP addresses would have to be unique right? If you know of any on-line references dealing with this subject let me know.

Also these are simple MS Access databases and not MS SQL databases.

TcpClient connection in app_code fails to work

Hello,

I am just getting into asp.net development (have a winforms background)

I have a sockets server running on my windows 2003 machine. I made a class called ClientTcp that opens a new connection and sends a string to the server and placed this in APP_CODE.

I call ClientTcp :

public class ClientTCP{private TcpClient tcpClient;public void SendData(String toSend) { tcpClient =new TcpClient(CONNECT_ADDR, CONNECT_PORT); NetworkStream networkStream = tcpClient.GetStream(); StreamWriter streamWriter =new StreamWriter(networkStream, System.Text.Encoding.ASCII); streamWriter.WriteLine(toSend); streamWriter.Flush(); }}

From my code behind Default.aspx.cs:

ClientTCP c =new ClientTCP();c.SendData("In app_code");

This works great on my local VS 2005 debug but when this runs under IIS 6 on Windows 2003 no data is received by the socket server.

Is there some sort of permissions issue or scope issue with using a class in APP_CODE


Interesting enough if I place the SendData method directly in the Default.aspx.cs file then it opens a socket connection and sends the data.

I have looked around for clues but could not find out why the socket wont connect and send by calling a code behind.

Thanks

I have solved this isssue.

I didn't post the complete method in my earlier post. This code works correctly.

My issue was that I was attempting to build an XmlDocument and then converting that to a string and sending that string over the stream.

It seems that I cannot create an XmlDocument in memory under IIS6. Creating a temporary file and then using this may solve the real issue but I have worked around this by building a custom string builder to generate xml compliant strings.

Thanks