Free Support Forum - groupdocs.com

Issues with publishing to local IIS

I am using your ASP.NET_MVC_Front_End to test GroupDocs’ viewer.dll.

It is very good to show the documents in image format when the project is with IIS express server by running F5 from VS2015.
However, I had some hard time to publish it to the local IIS.
At first I could not make it work. I was using file system in the publish. I successfully created a virtual directory under inetpub\wwwroot and convert it into an application under default web site in IIS manager. I also gave full permission to IIS_IUSRS. But it did not work. We had to modify the file _Layout.cshtml to make it work.
(*** We changed a few lines! Attached here is our file. ***)
Now it shows the right page with right user interface. I can use it to open a document and show it in image format.
But sometimes it still did not work very well. Sometimes it only showed 2 pages for each document. I have to say it is not stable and worse than the results from running F5 in VS2015. I have no idea about what happened.
Based on the original project from GroupDocs,
I only modified code to put the temp license in, changed index.cshtml to only show the documents in image format, and the third one is this _Layout.cshtml.

When using file system for publishing the web app, I simply follow the instructions from VS 2015 to give it a name, create a folder in c:\inetpub\wwwroot, convert it to an application, edit its permission, then publish!

You must have lots of experience on publishing it to local IIS on the same computer.
Did you change anything when publishing to local IIS?
If you changed any files, please send them to me.

Your help will be greatly appreciated!

Hi Yuan,


Thanks for using GroupDocs.Viewer for .NET.

I have checked your provided _Layout.cshtml and you have made correct changes. IIS Manager may have certain configurations that may differ from when you run the application directly from Visual Studio. This is the reason that you have to change the paths of .js and .css files accordingly and use “~” sign for root directory.

Secondly, the reason behind the issue of displaying only 2 pages can be the use of expired license. You can check if your license is expired or not by opening the license file in Notepad and check the value of tag. In case your license is not expired, please check whether you have provided the appropriate permissions/rights to the folder where the license file is located. Hope it helps.

We shall be looking forward to your feedback.

Warm Regards

I have checked the directory for the temp license. The permission is good. And the license is good until 12/21/2016.

However, I still got 2 pages for candy.pdf, demo.docx, and sample.pptx. The worst one is sample.xlsx. This is the 4th one and should have no license issue. But I still got the water mark message: unlicensed version of GroupDocs.viewer for >net … and then I got an error message: Error, The page 1 can’t be loaded. I am wondering why I did not got this error when showing the first three documents.

Any idea???



I will move the tmp license file to c:\users\public folder to see if the running result will be better or not!

Hi Yuan,


Thanks for your detailed response.

It might be possible that the API is picking up the rendered pages and document information from the cache. Therefore, please remove the contents of temp folder which will be located in storage directory of your application and run the application again. Please try and share your feedback with us.

Warm Regards

When I move the license file around, the result is worse! It must be from the cache!

I already know the trick of temp files. I delete them before testing.

Do you know where is the code to do the caching? I want to turn it off. The performance may be worse. But the result should be better!



When I run it from VS2015, the result is good!

When I use updated _Layout.cshtml for publishing to local IIS, then funny things happen!

Can you tell me where I should turn the cache off!

This forces me to jump into the debugger when I run it from VS2015 by using F5.

In the debugger I see everything is fine. The page numbers is correct.

Then I switch to local IIS. I jump into debugger by using F12 and attach the w3wp process to the VS2015 code. This time, I can see the number of pages is changed to 2.
Please tell me where is the code for checking the temp license? I guess it is inside the viewer.dll?

Hi Yuan,


Thanks for providing the details.

I have published the ASP.NET MVC Front End to IIS using your provided information and _Layout.cshtml file and everything is working fine. Please verify that your application is applying the license properly when it is deployed to IIS. You can turn off the cache by setting UseCache property to false in viewer configurations in ViewerController.cs file (see this screenshot). The code to apply the license is written in Global.asax.cs file (see this screenshot).

In case of any confusion, please feel free to let us know.

Warm Regards

I found and turned cache off 10 minutes ago.

Once I turn it off, , everything is fine now!
I guess something in the code related to the cache is not …

Your message confirmed this!

Thanks!

Hi Yuan,


Its good to know that everything is working fine now at your end. In case of any further issues, please feel free to contact us.

Warm Regards

To avoid the issues I explained in the previous post messages, I need to set useCache to false in ViewerController.cs.


Do you have any idea why?

Hi Yuan,


Thanks for your response.

You were facing the issue because the API was picking up cached files and information of the documents. However, when you set UseCache to false, the API does not look into cache anymore and instead, it renders the document every time you load it.

In case of any confusion, please feel free to write us.

Warm Regards