3

我有一个在 asp.net 框架上使用 SVG 坐标的网页。

通过试错,如果我取出大部分标签,我不会收到任何错误。但是如果所有标签都在我得到以下错误

Compiler Error Message: CS8095: Length of String constant exceeds current memory limit. Try splitting the string into multiple constants.
Line 195:        private global::System.Web.UI.LiteralControl              @__BuildControl__control2() {
Line 196:            global::System.Web.UI.LiteralControl @__ctrl;
Line 197:            @__ctrl = new     global::System.Web.UI.LiteralControl("\r\n\r\n  \r\n<div class=\"row\">\r\n          <div class=\"col-xs-24 banner section\">\r\n        " +
Line 198:                    "<div class=\"row\">\r\n<div class=\"col-xs-24     col-sm-14 map-container\"> <!-- MICHAEL:" +
Line 199:                    " be sure to add the class \'map-container\',     this is for the tooltip location -->\r" +

源代码是

<div class="col-xs-24 col-sm-14 map-container"> <!-- MICHAEL: be sure to add the class 'map-container', this is for the tooltip location -->
        <!-- <img class="map" src="images/map.svg" width="100%"> -->
<?xml version="1.0" encoding="utf-8"?>

        <!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
        <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
             viewBox="0 230.5 613.3 331" enable-background="new 0 230.5 613.3 331" xml:space="preserve">
        <g>
            <polygon fill="#FFFFFF" points="609.6,301.2 609.4,301.1 609.3,301.1 609.1,301 609,300.9 608.8,300.8 608.6,300.7 608.5,300.6
                608.4,300.4 608.3,300.3 608.2,300.1 608.1,299.9 608.1,299.8 608,299.6 608,299.4 608,299.2 608,299 608,298.9 608.1,298.7
                608.1,298.4 608.2,298.3 608.3,298.1 608.4,298 608.5,297.9 608.6,297.7 608.8,297.6 609,297.5 609.1,297.4 609.3,297.3
                609.4,297.3 609.6,297.2 609.8,297.2 610,297.2 610.2,297.2 610.4,297.2 610.5,297.3 610.8,297.3 610.9,297.4 611.1,297.5
                611.2,297.6 611.4,297.7 611.5,297.9 611.6,298 611.7,298.1 611.8,298.3 611.9,298.4 611.9,298.7 612,298.9 612,299 612,299.2
                612,299.4 612,299.6 611.9,299.8 611.9,299.9 611.8,300.1 611.7,300.3 611.6,300.4 611.5,300.6 611.4,300.7 611.2,300.8
                611.1,300.9 610.9,301 610.8,301.1 610.5,301.1 610.4,301.2 610.2,301.2 610,301.2 609.8,301.2     "/>
            <polygon fill="#FFFFFF" points="601.2,301.1 601.3,301 601.4,300.8 601.5,300.7 601.7,300.6 601.9,300.5 601.9,300.5 602.1,300.4
                602.2,300.4 602.4,300.3 602.6,300.3 602.7,300.3 602.8,300.3 602.9,300.3 603.1,300.3 603.4,300.4 603.5,300.4 603.6,300.5
                603.8,300.6 604,300.7 604.2,300.8 604.3,301 604.3,301.1 604.5,301.2 604.6,301.4 604.6,301.5 604.7,301.8 604.8,301.9
                604.8,302.1 604.8,302.4 604.8,302.5 604.8,302.7 604.7,302.9 604.6,303 604.6,303.2 604.5,303.3 604.3,303.5 604.3,303.7
                604.2,303.8 604,303.9 603.8,304 603.6,304.1 603.5,304.2 603.4,304.2 603.1,304.3 602.9,304.3 602.8,304.3 602.6,304.3
                602.4,304.3 602.2,304.2 602.1,304.2 601.9,304.1 601.7,304 601.5,303.9 601.4,303.8 601.3,303.7 601.2,303.5 601.1,303.3
                601,303.2 600.9,303 600.8,302.9 600.8,302.7 600.8,302.5 600.8,302.4 600.8,302.1 600.8,301.9 600.8,301.8 600.9,301.5 601,301.4
                601.1,301.2     "/>

+8000 多行

我能做些什么?我需要使用元素标签,因为使用 jquery 我将在这些标签上发生事件。所以我不能只指向文件。我需要所有

更新我将内联多边形标签缩小到 898kb 的 1 行,并且我注意到 VSBComplier.exe(类似的东西)占用了我的所有 RAM 并使我的浏览器崩溃。

仍然必须在注释中取出 svg 才能进行调试。

4

3 回答 3

1

问题是 iisexpress 与 iis.exe w3p.exe。这只发生在我的本地计算机上

在调试中它给出了这个错误。

把它放在生产服务器上,错误不会发生

希望这个线程有一个目的。即使我的电脑有足够的内存和空间。

于 2016-02-12T19:33:09.977 回答
0

如何将您的非常长的字符串常量分成几个块并将它们全部放在一个List<String>

此外,考虑使用单页应用程序方法,在其中对 Web 服务器进行 ajax 调用,该服务器将直接返回 SVG 数据,然后使用客户端编程(如 JQuery)显示 SVG 数据。这将避免必须在 ASP.NET MVC 的视图中呈现服务器端的东西。

于 2016-02-12T19:28:28.500 回答
0

在这里只是在黑暗中拍摄,为什么不通过 CSS 加载 SVG?

于 2016-02-12T19:29:59.110 回答