Click here to Skip to main content
15,894,405 members
Home / Discussions / C#
   

C#

 
AnswerRe: Backgroundworker Pin
Luc Pattyn18-Sep-09 7:11
sitebuilderLuc Pattyn18-Sep-09 7:11 
AnswerRe: Backgroundworker Pin
Luc Pattyn18-Sep-09 7:39
sitebuilderLuc Pattyn18-Sep-09 7:39 
AnswerRe: Backgroundworker Pin
Ian Shlasko18-Sep-09 8:19
Ian Shlasko18-Sep-09 8:19 
QuestionEnumerate a Listbox Pin
bxlorenz18-Sep-09 7:04
bxlorenz18-Sep-09 7:04 
AnswerRe: Enumerate a Listbox Pin
Luc Pattyn18-Sep-09 7:09
sitebuilderLuc Pattyn18-Sep-09 7:09 
QuestionCopy Files in C# with Duplicate Files (Corrupt ISO) Pin
Xtrodinary18-Sep-09 6:30
Xtrodinary18-Sep-09 6:30 
AnswerRe: Copy Files in C# with Duplicate Files (Corrupt ISO) Pin
jared.hildebrandt21-Oct-09 5:16
jared.hildebrandt21-Oct-09 5:16 
QuestionNo connection could be made because the target machine actively refused it Pin
Amritarth18-Sep-09 6:06
Amritarth18-Sep-09 6:06 
Dear Sir,
I know its very common problem which has been asked by many people but i did not get any of the persons way of immplementing Remoting as i did so please go through with my steps of my project and provide me solution...
The steps which i used in my program ....
Server Side Code...
my app.config code

<?

xml version="1.0" encoding="utf-8" ?> <
configuration>
<

connectionStrings>

<




add name="VitalDataBaseCon" connectionString ="initial Catalog=pubs ;uid=sa;pwd=success; server=VITAL-17\\VITAL17;integrated security=true"></add>

</




connectionStrings>

<




appSettings>

<




add key ="serverIp" value="192.168.1.17"/>

<




add key ="ServerPort" value="8080"/>

</




appSettings>

<




system.runtime.remoting>

<




customError Mode="on"/>

<




application>

<




service>

<




wellknown mode="SingleCall" type="Vital.DotNet.Server.LogIn,Server" objectUri="LogIn" />

</




service>



<




channels>

<




channel ref="tcp" secure="true" port="8080" impersonate="true" protectionLevel="EncryptAndSign"/>

</




channels>

</




application>



</




system.runtime.remoting>

</




configuration>

Server.cs


using



System;

using



System.Collections.Generic;

using



System.Text;

using



System.Data;

using



System.Data.SqlClient;

using



System.Configuration;

using



System.Runtime.Remoting.Lifetime;

using



System.Runtime.Remoting.Channels;

using



System.Runtime.Remoting.Channels.Tcp;

namespace



Vital.DotNet.Server

{




class LogIn:MarshalByRefObject,Vital.DotNet.Server.IvitalServerInterfaces

{




SqlDataAdapter adap;




SqlCommand cmd;




SqlConnection con;




public DataSet retriveData(string authorFirstName,string authorLastName,out bool isSuccess)

{





con =

new SqlConnection("initial Catalog=pubs ;uid=sa;pwd=success; server=VITAL-17\\VITAL17;integrated security=true");

con.Open();




SqlCommand cmd = new SqlCommand("Demoinput", con);

cmd.CommandType=


CommandType.StoredProcedure;

cmd.Parameters.Add(


new SqlParameter("@au_fname",authorFirstName));

cmd.Parameters.Add(


new SqlParameter("@au_lname",authorLastName));




DataSet ds = new DataSet();




SqlDataAdapter adap = new SqlDataAdapter(cmd);

adap.Fill(ds);




if (ds.Tables[0].Rows.Count == 0)

{

isSuccess =


false;

}




else

{

isSuccess =

true;

}




return ds;

}




static void Main(string[] args)

{




Console.ReadLine();



}

}

}

My procedure in pubs data base

create procedure [dbo].[Demoinput]( @au_lname varchar(50),@au_fname varchar(50))
as
begin
select * from authors
where au_lname=@au_lname
end

Interface on server side which has been added on client side as a DLL.


namespace




Vital.DotNet.Server

{




public interface IvitalServerInterfaces

{



DataSet retriveData(string authorFirstName, string authorLastName, out bool isSuccess);

}

}






CLIENT Side Code

client side app.config file


<?




xml version="1.0" encoding="utf-8" ?>

<




configuration>



<




appSettings>

<




add key ="serverIp" value="192.168.1.7"/>

<




add key ="ServerPort" value="9002"/>

</




appSettings>

<




system.runtime.remoting>

<




application>

<




channels>

<




channel ref="tcp" secure="true" tokenImpersonationLevel="Identification" username="" password=""/>

</




channels>

</




application>

</




system.runtime.remoting>

</




configuration>






client.cs



using




System;

using



System.Collections.Generic;

using



System.ComponentModel;

using



System.Data;

using



System.Drawing;

using



System.Text;

using



System.Windows.Forms;

using



Vital.DotNet.Server;

using



System.Configuration;

using



System.Runtime.Remoting.Lifetime;

using



System.Runtime.Remoting.Channels;

using



System.Runtime.Remoting.Channels.Tcp;

namespace



Vital.DotNet.client

{




public partial class Form1 : Form

{

Vital.DotNet.Server.

IvitalServerInterfaces ObjServerSide = null;




bool isSuccess = false;




public Form1()

{

InitializeComponent();

}




private void btnShow_Click(object sender, EventArgs e)

{




try

{

ObjServerSide = (

IvitalServerInterfaces)Activator.GetObject(typeof(IvitalServerInterfaces), @"tcp://192.168.1.17" + ":8080" + "/pop");

ObjServerSide.retriveData(txtAuthorFirstName.Text, txtAuthorLastName.Text,


out isSuccess);

}




catch (System.Runtime.Remoting.RemotingException ex)

{




MessageBox.Show(ex.Message);

}

}

}

}

please help me out from this problem ,i checked this code on remote computer(On LAN) as well as same computer but it doesnot work....

Thanks and regards
AMRITA VISHNOI

hi this is amrita.
Amrita

AnswerRe: No connection could be made because the target machine actively refused it Pin
EliottA18-Sep-09 6:31
EliottA18-Sep-09 6:31 
AnswerRe: No connection could be made because the target machine actively refused it Pin
Luc Pattyn18-Sep-09 6:31
sitebuilderLuc Pattyn18-Sep-09 6:31 
AnswerRe: No connection could be made because the target machine actively refused it Pin
Dave Kreskowiak18-Sep-09 7:27
mveDave Kreskowiak18-Sep-09 7:27 
AnswerRe: No connection could be made because the target machine actively refused it Pin
0x3c018-Sep-09 7:40
0x3c018-Sep-09 7:40 
AnswerRe: No connection could be made because the target machine actively refused it Pin
Arun Jacob18-Sep-09 19:00
Arun Jacob18-Sep-09 19:00 
QuestionHow to find total data downloaded and uploaded by user (using c# code) Pin
Ajay Kewale18-Sep-09 5:27
Ajay Kewale18-Sep-09 5:27 
AnswerRe: How to find total data downloaded and uploaded by user (using c# code) Pin
Eddy Vluggen18-Sep-09 9:53
professionalEddy Vluggen18-Sep-09 9:53 
QuestionHow to get upload status in steps Pin
vsaratkar18-Sep-09 5:12
vsaratkar18-Sep-09 5:12 
AnswerRe: How to get upload status in steps Pin
Not Active18-Sep-09 5:22
mentorNot Active18-Sep-09 5:22 
AnswerRe: How to get upload status in steps Pin
Dave Kreskowiak18-Sep-09 5:24
mveDave Kreskowiak18-Sep-09 5:24 
AnswerRe: How to get upload status in steps Pin
vsaratkar18-Sep-09 7:19
vsaratkar18-Sep-09 7:19 
QuestionAccessing to an Object in Section4 of a Crystal Report with C# ? Pin
Mohammad Dayyan18-Sep-09 5:07
Mohammad Dayyan18-Sep-09 5:07 
Questionplay video on the form without a control Pin
Jassim Rahma18-Sep-09 4:47
Jassim Rahma18-Sep-09 4:47 
AnswerRe: play video on the form without a control Pin
EliottA18-Sep-09 4:56
EliottA18-Sep-09 4:56 
Questionyour advise plz: Activate the software Pin
Jassim Rahma18-Sep-09 4:45
Jassim Rahma18-Sep-09 4:45 
AnswerRe: your advise plz: Activate the software Pin
EliottA18-Sep-09 4:55
EliottA18-Sep-09 4:55 
AnswerRe: your advise plz: Activate the software Pin
Henry Minute18-Sep-09 4:56
Henry Minute18-Sep-09 4:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.