|
The stack trace doesn't match the code you've posted - look at the overload of UploadFile .
Anyway, one suggestion: are you putting http:// in the uriString ?
WebClient can use different protocols and may be getting confused. The stack trace shows a failed connection to port 1031 which is being blocked by the firewall on your server.
Nick
----------------------------------
Be excellent to each other
|
|
|
|
|
Thanks Nick,
I have tried adding http:// is not working. I have posted my stack error and my code again. Hope it matches.
Any ideas what is wrong?
class Program
{
static void Main(string[] args)
{
Console.Write("\nPlease enter the URI to post data to : ");
String uriString = Console.ReadLine();
WebClient myWebClient = new WebClient();
Console.WriteLine("\nPlease enter the fully qualified path of the file to be uploaded to the URI");
string fileName = Console.ReadLine();
Console.WriteLine("Uploading {0} to {1} ...", fileName, uriString);
DateTime begin = DateTime.Now;
byte[] responseArray = null;
try
{
responseArray = myWebClient.UploadFile(uriString, fileName);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.WriteLine(ex.ToString());
}
DateTime end = DateTime.Now;
Console.WriteLine("Elapsed time is: {0}", (end - begin).TotalMilliseconds);
}
}
Unable to connect to the remote server
System.Net.WebException: Unable to connect to the remote server ---> System.Net.
Sockets.SocketException: No connection could be made because the target machine
actively refused it 10.10.12.162:1031
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddre
ss socketAddress)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Sock
et s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state,
IAsyncResult asyncResult, Int32 timeout, Exception& exception)
--- End of inner exception stack trace ---
at System.Net.WebClient.UploadFile(Uri address, String method, String fileNam
e)
at FileUploadClient.Program.Main(String[] args) in C:\software\UploadFile\Net
work_Monitor_Demo\FileUploadClient\Program.cs:line 27
Elapsed time is: 4579
regards,
George
|
|
|
|
|
The stack trace is still a bit off - are you using a Release build? You could try a Debug build to help track this down.
I don't understand why WebClient is trying to connect on port 1031. It should be using an HTTP POST on port 80.
Could you catch the WebException explicitly and print the Status code?
Also, 4.5 seconds is a long time accross a LAN. How big is the file you are sending? IIS has a limit of 4MB, but you can set this using MaxRequestLength[^] in your web.config:
<system.web>
<httpRuntime maxRequestLength="10240" />
If none of that works, you could try using UploadFileAsync and hooking the UploadProgressChanged event to see if anything is being sent.
Nick
----------------------------------
Be excellent to each other
|
|
|
|
|
Hi Nick!
Thanks for so many good ideas! I have followed your advice and here is my results.
1.
The port 1031 is the Visual Studio's internal web server address port number -- i.e. when I press F5 in Visual Studio 2008 for the ASP.Net project.
I have tried when I publish the ASP.Net project at server side to IIS and using port 80, everything is fine, but when pressing F5 to run in Visual Studio, there is such error. Any ideas?
2.
I have tracked the Status property for the WebException, the value is "ConnectFailure". Any ideas?
3.
The file is very small, about 1k and is a text file.
From my 3 points above, do you have any ideas why it fails to use Visual Studio internal web server and success to use IIS?
regards,
George
|
|
|
|
|
So, you've been entering "http://10.10.12.162:1031" for uriString ???
This will be blocked by the firewall on the machine running VS. This means that if you run the client on the same machine, it will work because you're not crossing the firewall. If you run the client on a different machine, it will try to go through the firewall on port 1031 and ( quite rightly ) be blocked => ConnectFailure.
It works on IIS using port 80 because this port is open on that machine's firewall - port 80 is the well known port for HTTP.
Your code is fine - it's a network admin problem.
Nick
----------------------------------
Be excellent to each other
|
|
|
|
|
And see File Uploading in ASP.NET Using C#[^] for more info.
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
HI ,
i have a web service installed in IIS of my server machine and in client system i have a C# windows application.This application has a refernce added of the service(dll has been added).This dll take the database connection from mentioned from app.config but i want it read the connection details from web.config of service.
Can you please help me out how can acheive this.
when i try system.web.configriatin.... it refer to client machine.I want it to refer the web.config of the service.
|
|
|
|
|
Hi,
This is from chandrakanth.This is regarding
" How to convert tiff file to text file using tesseract.ocr in C#(Asp.net)" .
Can any one tell me how to do tha asap.
Thanks and Regards
Gaddam.Chandrakanth
|
|
|
|
|
Hi there!
I am building a win application, and I am stucked at one point and I will appreciate your help, if we can solve this issue together. I have a combobox with more values in it. Depending on the person who is selected from listbox, the value in the combobox is different. I am taking that value from DB and I am holding in a string. I want when someone will select an item from the form, the combobox selected item be the value from the string. I already populate the items in the combobox, I just want to know how to make one of the items to be selected when the person will be selected from the list box. Any kind oh help will be appreciated. Thanks in advance, Laziale
|
|
|
|
|
hey hi,
i think u can change the combox selected value changed on list box selected item event.
|
|
|
|
|
combobox.SelectedItem = "item";
or
combobox.SelectedIndex = 0; // any item on 0th index
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Listen events from listbox.
I Love KongFu~
|
|
|
|
|
Can we block internet to client systems where
1. both server, an internet connection and client system are connected through a single hub or switch.
2. both client and server uses windows xp OS
The software which has to be develeoped uses Winforms where both client and server have 2 different set of applications. The client application provides an login option. when the user types in the login information, the information is sent to the system considered as server, authentication is done and if the login information is valid internet has to be provided to the system considered as client.
The internet should not be provided if the client application is installed and it is not running in the client system. Only if the client application is running and login is authenticated, the internet connection has to be provided to the system.
This software is developed for college project purpose. Can anyone assist me or send me the web service code such that internet connection is provided to client only after server authentication. And also how the server and client has to be connected through hub/switch in detail.
|
|
|
|
|
Even i am trying something like that, but my requirements are a bit different. I have a Windows Server 2003 enterprise standard acting as web server and a well defined network architecture using Sonic Wall as firewall and 3com network switches. Sonic Wall has limited functionality, so that's y i also have such a requirement of blocking a couple of users to all websites except a few business related sites. Once i complete it, i would be happy to guide you although i also have a vague idea of such a thing.
|
|
|
|
|
I am working in vb.net 2008 c#
My application work in two languages (English and Hindi)
In My application I use same font for both languages (Microsoft Sans serif)
Because in my application when I use Hindi font for Hindi in my Design are Disturb that’s I use same font.
My problem in Crystal Reports when I Exports the Reports in word the Hindi font are cut in the word file and when I imports in .pdf file that’s not show the Hindi font . If anybody have solution please give me please it’s urgent
And if anybody know that which font are use in both please that’s tell me also
|
|
|
|
|
I created a table in sqlserver database.Now, i want a code by which i can get the list of data of specific column of that table(eg. C_ID)in combobox in front end.
|
|
|
|
|
Assuming you're returning a DataSet[^] that contains one DataTable[^] that has two column[^]s, then this works.
Adapt to your specific situation.
comboBox1.DataSource = ds.Tables[0];
comboBox1.DisplayMember = "Display";
comboBox1.ValueMember = "ID";
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
hi,
i want to seach a keyword in the content of a attachment which is converted into bytearray[] and stored into sql as varchar(MAX) datatype.
now i wnt the to convert the key word into bytearray n i hv done that but now i hv to convert it into varchar(max) in my code .
can some one help me!!!!!!!!!!!!!!!!
|
|
|
|
|
why you making this so complicated ?
First search for a number, then convert it to byte[] then merge all array elements in sql varchar data type. Is this you are trying to do ?
If you wanna store byte[] in sql then you should use "Image" data type.
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
thanks for the reply...
i dont want to save it in db
actually i want to implement the search functionality where i want to find a keyword in all the attachment stored on db all the attachments r converted into bytearry through code then stored inti db as varchar
i want ti do the same with the keyword but i dont want to store it i want to pass it in my stored procedure i hv converted it into byteaaray n how do i encrypt it so that it is same as in db through my code
|
|
|
|
|
I have placed a datagrid in winforms and i added a bindingsource to the grid
after that i go to edit columns and changed the cell into datagrid combobox
one datagrid rows contains 10 columns
my question is depend upon the selection in the combo box the remaining all columns values should be displayed
any one can help me please
|
|
|
|
|
hi
i have to generate a report for my project and it is in the following format
Loads on Structure // Heading
Dead Load //Sub Heading1
Dead Load1 -- 200 KN/m
Dead Load2 -- 250 KN/m
Live Load // sub heading2
Live Load1 -- 150 KN/m
Live Load2 -- 100 KN/m
etc like
Now to display the report in this format
which report should i choose
and which one is best and has more advantages
i dont know about these reports
but by R&D i came to know that Report.rdlc cannot export to Ms-word application
now what to do ...
Please give me a good advise
Thanks in advance
lavan
|
|
|
|
|
I will try to run the nlp project. I don't know how to conver the ".nbin" file to ".bin".
|
|
|
|
|
F2 lets you rename a file. If you need to convert between formats, then you need to read up on the formats and write a converter.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hi everyone,
I know this's a lame question but what is the shortest way to modify a control in a separate thread without raising the cross-thread exception..
I basically have this datagrid control and when changing its databinding properties, it's binding fine except it doesn't show it correctly.
Please help guys!
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|