But when I run it in Visual Studio on Local IIS with virtual directory there are many errors in console of Google Chrome.
Url for images and other resources are incorrect.
For example: http://localhost/gd-signature/embedded/images/mainbg.png 404 (Not Found)
There is no virtual directory name after http://localhost/.
I researched that variables related to url creation are located in _Layout.cshtml (gdSignatureHostUrl ,ViewContext.AppPath, etc)
But i can not manage how to set them values in correct way.
Thanks for taking interest in GroupDocs.Signature for .NET.
What I infer from your question is, you are trying to run the project on your local IIS and you are facing some issues. Let’s address them gradually:
1- But when I run it in Visual Studio on Local IIS with virtual directory there are many errors in console of Google Chrome.
Url for images and other resources are incorrect.
For example: http://localhost/gd-signature/embedded/images/mainbg.png 404 (Not Found)
We are able to reproduce this issue at our end. Hence, it has been logged here.
You can keep track of the issue’s status by following the above mentioned link. Moreover, we will inform you as soon as we get any update on this issue from the concerned team.
As far as your second question is concerned:
There is no virtual directory name after http://localhost/.
I researched that variables related to url creation are located in _Layout.cshtml (gdSignatureHostUrl ,ViewContext.AppPath, etc)
But i can not manage how to set them values in correct way.
Can you please elaborate it a bit more? Did you create a virtual directory while configuring the site to use local IIS with some project URL instead of IIS express?
Actually to start development I have to demonstrate Signature.Net.Sample.Mvc hosted on IIS for possible clients.
Here are details about my second question.
You are right. In Visual Studio in properties of project to run Signature.Net.Sample.Mvc on Local IIS I write virtual directory name in Project URL field(see attached screen)
gdSignatureHostUrl from _Layout.cshtml is used in JavaScript funcions in DocViewer.all.part1.js and DocViewer.all.part2.js
Also those code snippets affects URL creating in JS:
var gdSignaturePrefix = 'gd-signature';
ViewContext.AppPath = '/gd-signature/signature2/';
ViewContext.PortalServiceHost = '/gd-signature/signature2/';
var gdSignatureHostUrl = '';
While running the project on my local IIS, it appends the project URL (and the virtual directory’s path) to the base address like http://localhost/ProjectURL (please have a look at this screenshot), so we are not able to reproduce this issue at our end. However, we have added the information you have provided to the issue logged already and the concerned team will investigate it. We will try to resolve the issue at our earliest and will update you on the issue’s status as soon as possible.
I apologize for the confusion. When I said we weren’t able to reproduce the issue I was referring to the second question from your initial post where you said and I quote “There is no virtual directory name after http://localhost/.” We are getting the virtual directory name at our end. Please let me know if I misunderstood your concern.
Now about the image URLs being incorrect, we really appreciate the research you have done and the points you have mentioned about the reasons behind the URL. Since this issue has been reproduced at our end we will try to resolve it at our earliest.
We have investigated the issue and reached at the conclusion that in the project we are referencing the static files using URLs like this: /images/file.jpg. Since your site is a virtual directory rather than an application in IIS, IIS will be looking in the “C:/inetpub/wwwroot” folder (The Default Website’s folder) for those static files and hence return a 404 error.
Now there can be a number of ways to handle this issue, the simplest one is explained here:
Change the Project Url to http://localhost/
You might get a message saying that localhost is mapped to a different folder and do you want to change it, select “Yes”
Now when you run the project, you can see the images (you can change the project url and append a name to it afterwards too)
What happens is that now you have changed the physical path of the default website running on local IIS and it now points towards your project’s directory instead of wwwroot. Another solution can be adding a new website using IIS Manager, with a physical address pointing towards your project’s path and having bound at some port other than 80, in this case you need to use a project URL like http://localhost:1024/name where 1024 must be the port that is bound to the new website (port number may vary).
Hope this solves your issue, in case it doesn’t, feel free to ask again.
Looking forward to hear from you.