Free Support Forum - aspose.com

Web app hangs when trying to render to browser

Hello:

I've deployed an application to a webserver that belongs to someone else.

The application eventually gets around to rendering a word doc via

"EmitDocToClientBrowser".

When I ts into the other machine, and access the site using the local host address "//localhost/applicationName" and then go to the page which generates the doc file, I push the button, and the doc file is rendered.

However, when I try to do this on a browser on my machine (http://123.111.122.333/applicationName), and then go to the same page, I push the button, and the application just hangs. I know that it wants to give me a word doc, because a dialog box comes up (as always) asking me about opening word files. But then it just hangs.

Maybe a firewall issue? Is there anything you can tell me to help me debug this issue?

thanks in advance...

david

Hello David,

Try to run our ASP.NET demo (Aspose.Word.Demos project) on your machine.

hello ... thanks for the rapid reply.

Just to be clear... let's call my machine M and the remote machine (the one that I've deployed to) R.

I ran the invitation from a browser on M, and it ran fine.

If I'm on a browser on M, going to the web app on M (i.e. //localhost/app), the word document renders just fine.

If I'm on a browser on M, and go to the web app installed on my local network (i.e. //SomeLocalMachine/app), the document renders fine as well.

If I'm on a browser on R, and go to the web app installed on R (i.e. //localhost/app), the word doc also renders correctly.

Now, if I'm in a browser on M, and go to the web app on R (i.e. //ThatMachineOverThere/app), the document doesn't render.

like is said; it seems like it's *trying* to render the word doc, since the warning dialog comes up about whether or not to open the doc.

thanks in advance

david

ps: i'm running 3.3.1.0

oh; by the way… ‘invitation’ was a reference to your ‘invitation’ demo on my machine

Then it's most probably the firewall or anti-virus or proxy configuration that prevents it from loading. But to be absolutely sure it's not Aspose.Word to blame you can compose a small ASP.NET configuaration that sends doc file over internet without using Aspose.Word at all. Simply write the doc file into response and set response mime type to application/msword.

umm... sorry if this is a bone head question, but could you help me with that?

with this code, word complains about the encoding; and I'd like to make sure there's nothing else wrong before I do the test...

private void Page_Load(object sender, System.EventArgs e)

{

Response.Clear();

Response.ClearHeaders();

Response.ClearContent();

Response.ContentType = "application/msword; name=test.doc" ;

Response.AppendHeader( "content-disposition","attachment; filename=test.doc");

string path=HttpContext.Current.Request.MapPath(HttpContext.Current.Request.ApplicationPath);

MemoryStream memStream = new MemoryStream();

BinaryWriter memWriter = new BinaryWriter(memStream);

FileStream f = System.IO.File.Open(path + "/test.doc",FileMode.Open,FileAccess.Read);

BinaryReader r = new BinaryReader(f);

char ch;

try

{

while(true)

{

ch=r.ReadChar();

memWriter.Write(ch);

}

}

catch{}

r.Close();

Response.BinaryWrite(memStream.GetBuffer());

}

I think you should not read chars - read and write bytes instead.

I agree with miklovan that this seems to be a machine configuration issue. I did not go into details, but it could be either remote (e.g. firewall issue) or local (browser). No comments how to fix your network configuration issues.

In your code you should read and write bytes.

Also, try issuing Response.End()

Thank you for your help.

well, the problem seems a bit intermittent.

I was able to get a snippet of code to render reliably with aspose.word.

The snippet executes on R, and renders when i'm in my browser at M (my local machine).

I also have a snippet of code that fails *mostly*. (like, 9 times out of 10). Unfortunately, the code *always* succeeds when I look at it running on my local machine.

So, the first question is, if the code fails to render intermittently, could it *still* be a configuration issue?

Send your code - maybe I will be able to help you.

here is a zip file.

so, there are two tests here. Emit.aspx and EmitTable.aspx

emit.aspx always works everywhere. emitTable.aspx always works on my local machines and within my local network, but *usually* fails when running on the deployed server.

for instance, if you were to go to: http://testing.studentEfolio.org/wwt/emitTable.aspx, you would *likely* witness it fail. The file there is exactly what's in EmitTable.aspx in the zip file.

thanks in advance for looking at this.

david

I have tested the link

http://testing.studentEfolio.org/wwt/emitTable.aspx

about 30 time in a row and it opens word doc in a browser without any problem.

I will still look into your code and post you back.

I can find nothing criminal in your code. Although I've streamlined it a little according to our recommendations. Among changes I've made:

The license file included in dll as an embedded resource.

The license activation code moved to Application_Start in global.asax file.

There is no need of using Word class. It's for COM interop only. So I've removed it.

You can use Response instead of HttpContext.Current.Response and Request instead of HttpContext.Current.Request and Server.MapPath instead of HttpContext.Current.Request.MapPath. They are basically identical but more concise.

I've added Response.End() to the end of Page_Load handler just in case.

But all these changes are basically cosmetics and probably have nothing to do with your problems.

You should really contact your system administrator on this.

thank you very much for your help.

i tried the url from a machine outside our local network,

and the links work. I will look into local issues.