I'm using Visual Studio 2012, I made custom tiles for a map I'm using with Leaflet. I have a simple HTML page that can display my custom map with my custom tiles but when I'm trying to use the same code in my ASP site, then I;m not sure how to have the tiles appear. I have created a folder to contain the tiles within the project and tried to reference it with the local file path but when I'm debugging I notice that my site is going through IIS somehow cause it navigates to the page w/ a localhost and port in the address. Is there something I can change in the web.config to have access to my tiles?
我正在使用Visual Studio 2012,我为我正在使用Leaflet的地图制作了自定义图块。我有一个简单的HTML页面,可以使用我的自定义图块显示我的自定义地图,但当我尝试在我的ASP网站中使用相同的代码时,我;我不确定如何显示图块。我已经创建了一个文件夹来包含项目中的tile并尝试使用本地文件路径引用它但是当我调试时我发现我的站点通过IIS以某种方式导致它导航到具有localhost和端口的页面在地址。我可以在web.config中更改某些内容以访问我的磁贴吗?
1 个解决方案
#1
1
The debugger compiles your project and launches it as an application using a lightweight version of IIS. It then opens a browser of your choice to view the website "online". When you publish the project (build>publish) you can move these files to a web server. The reason you see localhost is because the site is being hosted locally (on your machine) and is not public-facing yet.
调试器编译您的项目并使用轻量级的IIS将其作为应用程序启动。然后打开您选择的浏览器以在线查看网站。发布项目(build> publish)时,可以将这些文件移动到Web服务器。您看到localhost的原因是因为该站点在本地(在您的计算机上)托管,并且尚未面向公众。
If you want to reference files in your directory, use a preceding forward slash for for root directory. IE src="/images/tiles/leaflet.png" This will make the code adapt to any domain you might host it on.
如果要引用目录中的文件,请使用前面的正斜杠作为根目录。 IE src =“/ images / tiles / leaflet.png”这将使代码适应您可能托管它的任何域。
#1
1
The debugger compiles your project and launches it as an application using a lightweight version of IIS. It then opens a browser of your choice to view the website "online". When you publish the project (build>publish) you can move these files to a web server. The reason you see localhost is because the site is being hosted locally (on your machine) and is not public-facing yet.
调试器编译您的项目并使用轻量级的IIS将其作为应用程序启动。然后打开您选择的浏览器以在线查看网站。发布项目(build> publish)时,可以将这些文件移动到Web服务器。您看到localhost的原因是因为该站点在本地(在您的计算机上)托管,并且尚未面向公众。
If you want to reference files in your directory, use a preceding forward slash for for root directory. IE src="/images/tiles/leaflet.png" This will make the code adapt to any domain you might host it on.
如果要引用目录中的文件,请使用前面的正斜杠作为根目录。 IE src =“/ images / tiles / leaflet.png”这将使代码适应您可能托管它的任何域。