你可以查下你那边程序集有没有那个googlemap js资源,如果有的话就是程序强签名的问题了……

解决方案 »

  1.   

    你看下你的web.config里面有没有配置引用googlemap.js文件,没有的话要按上面报错的字符串引用进去,我忘了js文件不存在强签名的问题的……
      

  2.   

    你好,我应该怎么加入到web.config里面呢 
     <add assembly="MapControl, Version=1.0.4947.20127, Culture=neutral, PublicKeyToken=null"/>
    这样吗? 加入之后还是没有用...
    是不是命名空间的问题...
      

  3.   

    晕,看你的目录结构明显没有引用mapcontrol那个项目啊,要先点击你的初始项目右键选择引用把那个资源引用进来,即使是同一个解决方案下的不同项目之间要引用也是要添加引用的啊
      

  4.   


    你好,还是继续问下你
    这样算是引用了么?
    可是还是出现问题
    程序集“MapControl, Version=1.0.4947.31539, Culture=neutral, PublicKeyToken=null”不包含名称为“MapControl.GoogleMap.js”的 Web 资源。
    这是数字变了
      

  5.   

    那是版本问题吧,你右击那个mapcontrol 的dll属性看下版本是哪个版本的,是编译的时候报这个错误么?调式运行的时候在哪句报的错?
      

  6.   

    调试和编译的时候都报这样的错误
    还有就是我对比了正确的例子 发现webconfig不一样
    这是我的webconfig
    这个是可以运行的成功例子的webconfig
    加断点的话 我都不知道该加到哪
      

  7.   


    调试和编译的时候都报这样的错误
    还有就是我对比了正确的例子 发现webconfig不一样
    这是我的webconfig
    这个是可以运行的成功例子的webconfig
    加断点的话 我都不知道该加到哪
      

  8.   

    你查看下成功例子的webconfig有没有添加对mapcontrol的引用,有的话照着他那样的方法也添加进去
      

  9.   

    我发现成功例子的webconfig东西很少
    但是我自己写的例子的webconfig多出了好多 这问题到底出在哪..
    <?xml version="1.0"?>
    <!-- 
        注意: 除了手动编辑此文件外,您还可以使用 
        Web 管理工具来配置应用程序的设置。可以使用 Visual Studio 中的
        “网站”->“Asp.Net 配置”选项。
        设置和注释的完整列表可以在
        machine.config.comments 中找到,该文件通常位于
          \Windows\Microsoft.Net\Framework\vx.x\Config 中 
    -->
    <configuration>
    <configSections>
    <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
    <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
    <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
    <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
    <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/>
    <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
    <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
    <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
    </sectionGroup>
    </sectionGroup>
    </sectionGroup>
    </configSections>
    <appSettings/>
    <connectionStrings/>
    <system.web>
    <!-- 
                设置 compilation debug="true" 可将调试符号插入到
                已编译的页面。由于这会
                影响性能,因此请仅在开发过程中将此值
                设置为 true。
            -->
    <compilation debug="false">
    <assemblies>
    <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
    <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
    <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
    </assemblies>
    </compilation>
    <!--
                通过 <authentication> 节可以配置
                安全身份验证模式,ASP.NET 
                使用该模式来识别来访用户身份。 
            -->
    <authentication mode="Windows"/>
    <!--
                如果在执行请求的过程中出现未处理的错误,
                则通过 <customErrors> 节
                可以配置相应的处理步骤。具体而言,
                开发人员通过该节可配置要显示的 html 错误页,
                以代替错误堆栈跟踪。        <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
                <error statusCode="403" redirect="NoAccess.htm" />
                <error statusCode="404" redirect="FileNotFound.htm" />
            </customErrors>
            -->
    <pages>
    <controls>
    <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    </controls>
    </pages>
    <httpHandlers>
    <remove verb="*" path="*.asmx"/>
    <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
    </httpHandlers>
    <httpModules>
    <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    </httpModules>
    </system.web>
    <system.codedom>
    <compilers>
    <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    <providerOption name="CompilerVersion" value="v3.5"/>
    <providerOption name="WarnAsError" value="false"/>
    </compiler>
    <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" warningLevel="4" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    <providerOption name="CompilerVersion" value="v3.5"/>
    <providerOption name="OptionInfer" value="true"/>
    <providerOption name="WarnAsError" value="false"/>
    </compiler>
    </compilers>
    </system.codedom>
    <!-- 
            system.webServer 节是在 Internet Information Services 7.0 下运行 ASP.NET AJAX
            所必需的。对早期版本的 IIS 来说则不需要此节。
        -->
    <system.webServer>
    <validation validateIntegratedModeConfiguration="false"/>
    <modules>
    <remove name="ScriptModule"/>
    <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    </modules>
    <handlers>
    <remove name="WebServiceHandlerFactory-Integrated"/>
    <remove name="ScriptHandlerFactory"/>
    <remove name="ScriptHandlerFactoryAppServices"/>
    <remove name="ScriptResource"/>
    <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    </handlers>
    </system.webServer>
    <runtime>
    <assemblyBinding appliesTo="v2.0.50727" xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
    <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>
    <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
    </dependentAssembly>
    <dependentAssembly>
    <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/>
    <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
    </dependentAssembly>
    </assemblyBinding>
    </runtime>
    </configuration>
      

  10.   

    这个是ajax服务器控件的代码
    GoogleMap.cs
    using System;
    using System.Collections.Generic;
    using System.Configuration;
    using System.Linq;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    using System.Xml.Linq;namespace MapControl
    {
        /// <summary>
        /// ServerControl1 的摘要说明
        /// </summary>
        public class GoogleMap : WebControl,IScriptControl
        {
            private int _Zoom = 8;
            /// <summary>
            /// Gets or sets a value representing the zoom of the map.
            /// </summary>
            public int Zoom
            {
                get { return this._Zoom; }
                set { this._Zoom = value; }
            }        /// <summary>
            /// Gets or sets the latitude value of the initial center point on the map.
            /// </summary>
            public double CenterLatitude { get; set; }        /// <summary>
            /// Gets or sets the longitude value of the initial center point on the map.
            /// </summary>
            public double CenterLongitude { get; set; }        private ScriptManager sm;        public GoogleMap()
            {
                //
                // TODO: 在此处添加构造函数逻辑
                //
            }
            protected override HtmlTextWriterTag TagKey
            {
                get
                {
                    return HtmlTextWriterTag.Div;
                }
            }        protected override void OnPreRender(EventArgs e)
            {
                if (!this.DesignMode)
                {
                    // Test for ScriptManager and register if it exists
                    sm = ScriptManager.GetCurrent(Page);                if (sm == null)
                        throw new HttpException("A ScriptManager control must exist on the current page.");                sm.RegisterScriptControl(this);
                }            base.OnPreRender(e);
            }        protected override void Render(HtmlTextWriter writer)
            {
                if (!this.DesignMode)
                    sm.RegisterScriptDescriptors(this);            base.Render(writer);
            }        public IEnumerable<ScriptDescriptor>  GetScriptDescriptors()
            {
                ScriptControlDescriptor descriptor = new ScriptControlDescriptor("MapControl.GoogleMap", this.ClientID);
                descriptor.AddProperty("zoom", this.Zoom);
                descriptor.AddProperty("centerLatitude", this.CenterLatitude);
                descriptor.AddProperty("centerLongitude", this.CenterLongitude);
                yield return descriptor;
            }        // 生成脚本引用
            public IEnumerable<ScriptReference> GetScriptReferences()
            {
                yield return new ScriptReference("MapControl.GoogleMap.js", this.GetType().Assembly.FullName);
            }
        }
    }
    这个是GoogleMap.js
    /// <reference name="MicrosoftAjax.js"/>
    Type.registerNamespace("MapControl");MapControl.GoogleMap = function (element) {
        MapControl.GoogleMap.initializeBase(this, [element]);    this._zoom = null;
        this._centerLatitude = null;
        this._centerLongitude = null;
        //    this._ers = null;    this._mapObj = null;
    }MapControl.GoogleMap.prototype = {
        initialize: function () {
            MapControl.GoogleMap.callBaseMethod(this, 'initialize');        // 在此处添加自定义初始化
            this.createMap();
        },
        dispose: function () {
            //在此处添加自定义释放操作
            MapControl.GoogleMap.callBaseMethod(this, 'dispose');
        },
        get_zoom: function () {
            return this._zoom;
        },
        set_zoom: function (value) {
            if (this._zoom !== value) {
                this._zoom = value;
                this.raisePropertyChanged("zoom");
            }
        },
        get_centerLatitude: function () {
            return this._centerLatitude;
        },
        set_centerLatitude: function (value) {
            if (this._centerLatitude !== value) {
                this._centerLatitude = value;
                this.raisePropertyChanged("centerLatitude");
            }
        },
        get_centerLongitude: function () {
            return this._centerLongitude;
        },
        set_centerLongitude: function (value) {
            if (this._centerLongitude !== value) {
                this._centerLongitude = value;
                this.raisePropertyChanged("centerLongitude");
            }
        },
        createMap: function () {
            // Set the center point, zoom, and type of map
            var centerPoint = new google.maps.LatLng(this.get_centerLatitude(), this.get_centerLongitude());
            var options = {
                zoom: this.get_zoom(),
                center: centerPoint,
                mapTypeId: google.maps.MapTypeId.ROADMAP
            };
            // Create the map, using the above options
            this._mapObj = new google.maps.Map(this._element, options);
        } 
    }
        MapControl.GoogleMap.registerClass('MapControl.GoogleMap', Sys.UI.Control);
    if (typeof(Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();这个是ASP.NET网站Default.aspx
    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="MapControlTest._Default" %><%@ Register Namespace="MapControl" TagPrefix="mc" Assembly="MapControl" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
    </head>
    <body>
        <form id="form1" runat="server">
        <asp:ScriptManager runat="server" ID="ScriptManager1">
        </asp:ScriptManager>
        <div>
        <mc:GoogleMap ID="GoogleMap1" runat="server" CenterLatitude="36.1658" CenterLongitude="-86.7844"
                Width="500" Height="500">
                </mc:GoogleMap>
        </div>
        </form>
    </body>
    </html>就是这三部分代码 
      

  11.   

    晕,要不你把那程序当资源发到你的csdn资源里,在我地址给我我去下载看看,因为现在完全上不了其他的网站……
      

  12.   


    你好,我把它发布成资源了,麻烦你帮我看一下,谢谢
    http://download.csdn.net/detail/i_popular/5783809
      

  13.   

    原因已经找到,请在上面的图片上显示的MapControl项目里的AssemblyInfo.cs的文件里面的最底下加入一行代码:
    [assembly: System.Web.UI.WebResource("MapControl.GoogleMap.js", "application/x-javascript")]
      

  14.   

    本来想回答你的,刚做了google地图api的,然后看你找到原因了,自己结贴哈
      

  15.   

    不错,不过刚开始做开发的,就直接调用这个数据接口吧!http://www.haoservice.com/docs/20