浏览到WIndows 2012网站时出现F12控制台窗口JavaScript浏览器错误

时间:2020-02-01 20:54:36

标签: asp.net iis

我已在主页上将带有JavaScript Google Map的ASP .NET应用程序部署到Windows 2012网站。现在,当我浏览到该应用程序时,它会正常运行,但不会加载Google Map。在F12控制台Windows调试器上,这是我遇到的错误:

SEC7120:在以下位置找不到起源http://mymachinename Access-Control-Allow-Origin标头。

SCRIPTING7002:XMLHttpRequest:网络错误0X80700013,无法 由于错误80700013而无法完成操作。

构造GPToolsService时,getPreferences失败:未定义

<script type="text/javascript">

        var map;

        MoW.ready(function () {
            map = new MoW.Map({
                target: 'MoWmap'
            });
        });

        window.onload = function () {

            MoW.ready(function () {

                if (document.getElementById('<%= KMLOPString.ClientID %>').value !== "") {
                    var overlayPropertiesOP = {
                        "name": "Openations KML",
                        "url": document.getElementById('<%= KMLOPString.ClientID %>').value,
                        "type": MoW.protocols.KMLProtocol.TYPE.STRING,
                        "description": "Demonstrating KML overlay",
                        "mapTypeId": "google.map.mapTypeId.ROADMAP"
                    };

                    var newOverlayObjectOP = MoW.Factory.createKMLOverlay(overlayPropertiesOP);

                    map.addOverlay(newOverlayObjectOP, {
                        showAlert: true

                    });

       //             map.setBasemap(MoW.Basemap.ID.ROADMAP);
                }

                if (document.getElementById('<%= KMLESString.ClientID %>').value !== "") {
                    var overlayPropertiesES = {
                        "name": "Exercises KML",
                        "url": document.getElementById('<%= KMLESString.ClientID %>').value,
                        "type": MoW.protocols.KMLProtocol.TYPE.STRING,
                        "description": "Demonstrating KML overlay",
                        "mapTypeId": "google.map.mapTypeId.ROADMAP"
                    };

                    var newOverlayObjectES = MoW.Factory.createKMLOverlay(overlayPropertiesES);

                    map.addOverlay(newOverlayObjectES, {
                        showAlert: true

                    });
                }

         //       map.setBasemap(MoW.Basemap.ID.ROADMAP);

            });

        }


        function kmlBtnClick() {

            var overlayProperties = {
                "name": "Example KML Overlay",
                "url": document.getElementById('<%= KMLESString.ClientID %>').value,
                "type": MoW.protocols.KMLProtocol.TYPE.STRING,
                "description": "Demonstrating KML overlay"
            };

            var newOverlayObject = MoW.Factory.createKMLOverlay(overlayProperties);

            map.addOverlay(newOverlayObject, {
                showAlert: true
            });

            map.setBasemap(google.maps.mapTypeId.ROADMAP);
        }

    </script>

0 个答案:

没有答案