i have this error message.
what's my problem ? i check Nameserver and WSA's log file but i dot't saw any problem.
The remote server returned an error: (500) Internal Server Error.
konum: System.Net.HttpWebRequest.GetResponse()
konum: Service..ctor() c:\Documents and Settings\Esra\Belgelerim\Visual Studio 2010\WebSites\WebSite5\App_Code\Service.cs içinde: satır 92
System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: Failed to connect to the target machine actively refused it 127.0.0.1:8080
This code
using
System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Net;
using System.IO;
using System.Windows.Forms;
using System.Text;
using System.Configuration;
[WebService(Namespace = "http://serverip:8080/wsa/wsa1")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// 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 Service : System.Web.Services.WebService
{
private string ServerIP;
private string UserID;
private string Password;
public Service(string ServerIP, string UserID, string Password)
{
this.ServerIP = ServerIP;
this.UserID = UserID == null ? "administrator" : UserID;
this.Password = Password == null ? "987654321" : Password;
}
public Service()
{
string content = @"<?xml version='1.0' encoding='utf-8'?>
<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>
<soap:Body>
<test xmlns='http://serverip:8080/wsa/wsa1' />
</soap:Body>
</soap:Envelope>";
string url = @"http://serverip:8080/wsa/wsa1";
string contentType = @"text/xml; charset=utf-8";
string method = "POST";
string header = "SOAPAction: \'http://serverip:8080/wsa/wsa1/test\'";
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
ASCIIEncoding ascii = new ASCIIEncoding();
byte[] bytes = System.Text.Encoding.ASCII.GetBytes(content);
req.Credentials = new NetworkCredential(UserID, Password);
req.KeepAlive = false;
req.Method = method;
req.ContentLength = bytes.Length;
req.ContentType = contentType;
req.UserAgent = "Mozilla/3.5 (compatible; My Browser/1.0)";
req.PreAuthenticate = true;
req.ProtocolVersion = HttpVersion.Version10;
req.ContentLength = content.Length;
//req.Proxy = System.Net.WebProxy.GetDefaultProxy();
req.AllowAutoRedirect = true;
req.MaximumAutomaticRedirections = 10;
req.Timeout = (int)new TimeSpan(0, 0, 60).TotalMilliseconds;
req.Headers.Add(header);
req.Timeout=1000000;
try
{
Stream strReguest = req.GetRequestStream();
strReguest.Write(bytes, 0, bytes.Length);
strReguest.Close();
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
}
try
{
HttpWebResponse reps = (HttpWebResponse)req.GetResponse();
Stream strResponse = reps.GetResponseStream();
StreamReader sr = new StreamReader(strResponse, Encoding.UTF8);
Console.WriteLine(sr.ReadToEnd());
sr.Close();
}
catch(Exception ex) {
MessageBox.Show(ex.ToString());
}
}
[WebMethod]
public string test()
{
WebReference.ReklamAppService rek = new WebReference.ReklamAppService();
string pout = "ok";
return rek.test("name", out pout);
}
}
what's my problem ? i check Nameserver and WSA's log file but i dot't saw any problem.
The remote server returned an error: (500) Internal Server Error.
konum: System.Net.HttpWebRequest.GetResponse()
konum: Service..ctor() c:\Documents and Settings\Esra\Belgelerim\Visual Studio 2010\WebSites\WebSite5\App_Code\Service.cs içinde: satır 92
System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: Failed to connect to the target machine actively refused it 127.0.0.1:8080
This code
using
System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Net;
using System.IO;
using System.Windows.Forms;
using System.Text;
using System.Configuration;
[WebService(Namespace = "http://serverip:8080/wsa/wsa1")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// 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 Service : System.Web.Services.WebService
{
private string ServerIP;
private string UserID;
private string Password;
public Service(string ServerIP, string UserID, string Password)
{
this.ServerIP = ServerIP;
this.UserID = UserID == null ? "administrator" : UserID;
this.Password = Password == null ? "987654321" : Password;
}
public Service()
{
string content = @"<?xml version='1.0' encoding='utf-8'?>
<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>
<soap:Body>
<test xmlns='http://serverip:8080/wsa/wsa1' />
</soap:Body>
</soap:Envelope>";
string url = @"http://serverip:8080/wsa/wsa1";
string contentType = @"text/xml; charset=utf-8";
string method = "POST";
string header = "SOAPAction: \'http://serverip:8080/wsa/wsa1/test\'";
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
ASCIIEncoding ascii = new ASCIIEncoding();
byte[] bytes = System.Text.Encoding.ASCII.GetBytes(content);
req.Credentials = new NetworkCredential(UserID, Password);
req.KeepAlive = false;
req.Method = method;
req.ContentLength = bytes.Length;
req.ContentType = contentType;
req.UserAgent = "Mozilla/3.5 (compatible; My Browser/1.0)";
req.PreAuthenticate = true;
req.ProtocolVersion = HttpVersion.Version10;
req.ContentLength = content.Length;
//req.Proxy = System.Net.WebProxy.GetDefaultProxy();
req.AllowAutoRedirect = true;
req.MaximumAutomaticRedirections = 10;
req.Timeout = (int)new TimeSpan(0, 0, 60).TotalMilliseconds;
req.Headers.Add(header);
req.Timeout=1000000;
try
{
Stream strReguest = req.GetRequestStream();
strReguest.Write(bytes, 0, bytes.Length);
strReguest.Close();
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
}
try
{
HttpWebResponse reps = (HttpWebResponse)req.GetResponse();
Stream strResponse = reps.GetResponseStream();
StreamReader sr = new StreamReader(strResponse, Encoding.UTF8);
Console.WriteLine(sr.ReadToEnd());
sr.Close();
}
catch(Exception ex) {
MessageBox.Show(ex.ToString());
}
}
[WebMethod]
public string test()
{
WebReference.ReklamAppService rek = new WebReference.ReklamAppService();
string pout = "ok";
return rek.test("name", out pout);
}
}