|
It is probably in the WCF's web.config file, depending on how you have set things up.
|
|
|
|
|
Hello,
I dont have "XmlDictionaryReaderQuotas" in web.config of my project (web service).
Thank you verry mutch.
modified on Sunday, December 26, 2010 1:25 PM
|
|
|
|
|
is your service a wcf service or do you have asmx files?
|
|
|
|
|
i have asmx files.
Thank you verry mutch.
|
|
|
|
|
I can only find answers for WCF services, and it's been so long since I've touched plain SOAP services that I can't really help. Sorry.
|
|
|
|
|
Hello,
My web service modify the PDF File, in the input parameters i set the encoding base 64 of my original PDF but there are the excpetion when i try to get the encoding base 64 of my pdf modified.
What is the difference between the asmx et wcf ?
Thank you verry mutch.
modified on Sunday, December 26, 2010 2:11 PM
|
|
|
|
|
Hello,
I test my web service with soapUI, my methos return the correct encode base 64.
I call the web service correctly ?
Thank you verry mutch.
|
|
|
|
|
Hi!
I have a native win32 console application and it gives some outputs. I want to redirect its output(error out too) to my WPF app in real-time (asynchronously), I use this code, but all I have - result after the process is finished!
private void button2_Click(object sender, RoutedEventArgs e)
{
Process sortProcess;
sortProcess = new Process();
sortProcess.StartInfo.FileName = textBox1.Text;
sortProcess.StartInfo.UseShellExecute = false;
sortProcess.StartInfo.RedirectStandardOutput = true;
sortOutput = new StringBuilder("");
sortProcess.OutputDataReceived += new DataReceivedEventHandler(SortOutputHandler);
sortProcess.StartInfo.RedirectStandardInput = true;
sortProcess.Start();
sortProcess.BeginOutputReadLine();
sortProcess.Close();
}
private void SortOutputHandler(object sendingProcess,
DataReceivedEventArgs outLine)
{
if (!String.IsNullOrEmpty(outLine.Data))
{
textBox2.Dispatcher.BeginInvoke(DispatcherPriority.Input, (Action)delegate()
{
textBox2.Text += outLine.Data + Environment.NewLine;
});
}
Any ideas?
Thanks!
|
|
|
|
|
Write this output to a file and read this file in your WPF application.
You might then read the file asynchronously - however the problem is that we don't have any way to know that the file text has changed.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
My latest tip/trick
|
|
|
|
|
Thanks, but I don`t want to use any files.
Here is the code that i use, but it is not a real - time!
private void button2_Click(object sender, RoutedEventArgs e)
{
Thread Runst = new Thread(Run);
Runst.Start();
}
public void Run()
{
ProcessStartInfo processStartInfo = new ProcessStartInfo("C:\\test.exe");
processStartInfo.ErrorDialog = false;
processStartInfo.UseShellExecute = false;
processStartInfo.RedirectStandardError = true;
processStartInfo.RedirectStandardInput = true;
processStartInfo.RedirectStandardOutput = true;
Process process = new Process();
process.StartInfo = processStartInfo;
bool processStarted = process.Start();
while (!process.StandardOutput.EndOfStream)
{
textBox2.Dispatcher.Invoke(DispatcherPriority.Normal, (Action)delegate()
{
textBox2.Text += process.StandardOutput.ReadLine() + Environment.NewLine;
});
}
}
test.cpp
#include <stdio.h>
#include <windows.h>
int main()
{
for (int i=0;i<=30;i++)
{
fprintf(stdout,"%d) This is NORMALL stout (0-30)\n",i);
Sleep(100);
}
}
Also,this is not a solution!
process.OutputDataReceived += new DataReceivedEventHandler(CatchOutHandler);
|
|
|
|
|
I'm not sure, but here is my best guess:
it is all about the definition of "new line".
On Windows systems, a native C/C++ program creates a "new line" by outputting a \n which basically is the ASCII linefeed; Windows however by default wants a carriagereturn+linefeed, therefore most run-times will expand \n to \n\r automatically.
Again on Windows systems, a managed code program uses \n\r as newline string, see Environment.NewLine (Note: Mono on Unix would simply use \n here).
For serial ports, the user can set a different newline string, see SerialPort.NewLine
For streams, like you are using, there is no such facility.
Now my guess is that your C program, writing to a stream rather than a real output device (such as the console), doesn't get itsn expanded to \n\r, which your managed code is looking for; therefore the output is not multi-line, and only gets captured when the producer terminates.
If all the above applies, then these are some solutions:
1.
replace every \n by \n\r in your producer (C code)
2.
or stop using all the line-oriented stuff (the DataReceived handlers and the ReadLine method) in your consumer; instead use a thread with a loop, and read arbitrary strings. Note: two threads would be required if you wanted to deal with real-time stdout and stderr.
FWIW: the situation may get more complicated when you are on a virtual system; I have been told Citrix for example does not handle interprocess streams properly (although it might have been a \n versus \n\r issue there too).
|
|
|
|
|
Luc Pattyn, thank you very much!
That was very useful!
But, unfortunately, replacing \n by \n\r didn`t do the trick!
Besides, with a real-world app, I won`t have an opportunity to do that!
Because, the app which out I want to redirect, was written not by me,
and I don`t have its source code!
Please, can you provide me with a source code example,
which will use a thread with a loop, and reading arbitrary strings?
I didn`t understand this solution!
Thanks!
|
|
|
|
|
This is a first draft, I did not test it:
bool stdReading;
StreamReader stdout;
StreamReader stderr;
public void LaunchProcess() {
ProcessStartInfo psi=new ProcessStartInfo();
psi....
log("Starting process");
Process p=Process.Start(psi);
stdout=p.StandardOutput;
stderr=p.StandardError;
stdReading=true;
Thread outThread=new Thread(new ThreadStart(outReader));
outThread.Start();
Thread errThread=new Thread(new ThreadStart(errReader));
errThread.Start();
p.WaitForExit();
log("Process is done");
Thread.Sleep(300);
stdReading=false;
errThread.Join(300);
outThread.Join(300);
log("Reading streams in done");
}
public void outReader() {
int DIM=1024;
char[] buf=new char[DIM];
while (stdReading) {
int count=stdout.Read(buf, 0, DIM);
string s=new string(buf, 0, count);
...
}
}
public void errReader() {
int DIM=1024;
char[] buf=new char[DIM];
while (stdReading) {
int count=stdout.Read(buf, 0, DIM);
string s=new string(buf, 0, count);
...
}
}
Notes:
1. you may want to decrease DIM to get the output sooner when lines are short;
2. you may want to set Thread.IsBackground true so the threads don't prevent app termination.
|
|
|
|
|
Now I understood!
It Seems to work!!!
This is the magic solution!!!!
Luc Pattyn, thanks!
Thank you very much for all your help!!!
|
|
|
|
|
you're welcome.
|
|
|
|
|
|
Figured out, that if a native win32 console application
didn`t fflush its stdout and stderr,
redirecting its output is a real problem!
Is it possible to redirect 'bad' console apps,
(without fflush(stdout))?
Also found solution, by _Olivier_, but I don`t want to use
any stubs an 'between stuff'!
Real-Time Console Output Redirection[^]
Thank you all, for your help!
|
|
|
|
|
public class MyTextBox : TextBox
{
private static Dictionary<IntPtr, WeakReference> mList = new Dictionary<IntPtr, WeakReference>();
public MyTextBox()
{
mList.Add(Handle, new WeakReference(this));
}
}
Any problem for MyTextBox being garbage collected?
|
|
|
|
|
I recommend that you google ".net weak references". You'll get over 6.8 million results back, and there appear to be a number of good links on the first page of results.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
If nothing has a strong reference to MyTextBox, then yeah, it could get GC'ed. Thats why its called a WeakReference. Why would you use a WeakReference here anyways?
|
|
|
|
|
Making it weak reference will not prevent GC to play it's role. It's static. If it's not weak reference strong references of hundreds of textboxes in my app get polluted. I just bother with the textboxes that are really alive.
|
|
|
|
|
If you're relying on the reference being there, then you either need something that can recreate the reference when needed, or you need to maintain a strong reference.
|
|
|
|
|
I just bother with the textboxes that are really alive.
|
|
|
|
|
Objects of type MyTextBox will be collected if there are no strong references to them and, of course, the GC performs a garbage collection. mList dictionary will not be collected becouse there is a static strong reference to it, unless you clear this reference. I guess you have a static method or property to access the contents of mList Dictionary, becouse if you don't this dictionary is completely useless, and I don't see how you should need it unless MyTextBox class was much more heavy than it seems to be.
|
|
|
|
|
thomus07 wrote: private static Dictionary<intptr, weakreference="">
What do you think is going to happen with that IntPtr when the GC collects the TextBox?
|
|
|
|