AjaxControlToolkit 发布后不工作。 ASP.net C#
我正在使用 ASP.net 和 C# 在 Visual Studio 2010 中编写一个应用程序。我使用的是通过 Nuget 安装的 AjaxControlToolkit,在本地计算机上测试时它运行良好。我的问题是,当我将网站在线发布到我们的服务器时,ajax 不起作用。 (下面两张图片。因为我是新用户,所以无法将它们发布在这里,但我有photobucket链接。忽略专辑名称,这是朋友的乐队名称..哈哈。)
这是一张照片当我在本地计算机上测试它时,它看起来是什么样子。请注意“电话号码”文本框中的 MaskedEditExtender,以及顶部导航栏的外观;普通的。 (http://i16.photobucket.com/albums/b25/MenOpause_is_awesome/Page1。 png)
这是我在线发布时的样子。 MaskedEditExtenders 不再在“电话号码”文本框中工作,并且我的导航栏由于某种原因而变得混乱。 (http://i16.photobucket.com/albums/b25/MenOpause_is_awesome/第2-1页.png)
我已经手动上传了我的项目,但使用 AjaxControlToolkit 时仍然会产生相同的结果。完全去掉 Ajax,它在我的本地计算机和发布的网站上看起来都很好;我只是没有真正想要使用的所有 Ajax 验证。如果需要,我可以向您提供我的代码,但似乎我只是在上传过程中丢失了某些目录或文件,或者某些东西无法正常工作或设置不正确。任何见解将不胜感激。预先感谢您,如果您知道原因,请告诉我是否有任何其他信息我可以提供。
编辑(已解决):我将以下行添加到我的 web.config 中,这显然修复了所有内容并使其在线工作:
<handlers>
<remove name="AXD-ISAPI-4.0-64" />
<remove name="AXD-ISAPI-4.0" />
<remove name="AboMapperCustom-27080" />
<remove name="AboMapperCustom-27079" />
<remove name="AboMapperCustom-27078" />
<remove name="AboMapperCustom-27077" />
<remove name="AboMapperCustom-27076" />
<remove name="AboMapperCustom-27075" />
<remove name="AboMapperCustom-27074" />
<remove name="AboMapperCustom-27073" />
<remove name="AboMapperCustom-27072" />
<remove name="AboMapperCustom-27062" />
<add name="AXD-ISAPI-4.0" path="*.axd" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" resourceType="Unspecified" requireAccess="Script" preCondition="classicMode,runtimeVersionv4.0,bitness32" />
<add name="AXD-ISAPI-4.0-64" path="*.axd" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" resourceType="Unspecified" requireAccess="Script" preCondition="classicMode,runtimeVersionv4.0,bitness64" />
<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</handlers>
I am writing an application in Visual Studio 2010 using ASP.net and C#. I'm using the AjaxControlToolkit which I installed through Nuget, and it works perfectly when testing on my local machine. My question is, when I publish the website online to our server, ajax doesn't work. (Two pictures below. Couldn't post them in here since I'm a new user, but I've got the photobucket links. Ignore the album name, it was a friend's band name..Haha.)
This is a picture of what it looks like when I test it on my local computer. Notice the MaskedEditExtender in the "Phone Number" text box, and how the Navigation bar up top looks; normal. (http://i16.photobucket.com/albums/b25/MenOpause_is_awesome/Page1.png)
This is how it looks when I publish it online. The MaskedEditExtenders don't work in the "Phone Number" textbox anymore, and my Navigation bar is all messed up for some reason. (http://i16.photobucket.com/albums/b25/MenOpause_is_awesome/Page2-1.png)
I've uploaded my project manually and still it yields the same results when using AjaxControlToolkit. Taking Ajax out entirely, it looks fine on my local machine and on the published website; I just don't have all the Ajax validations that I would really like to use. I can provide you with my code if needed, but it seems like I'm just missing some directory or file in the upload process, or something just isn't working or not set up right. Any insight would be greatly appreciated. Thank you in advanced and let me know if there's any other information I can provide if you might know the reason.
EDIT (SOLVED): I added the following line to my web.config, which fixed everything apparently and had it working online:
<handlers>
<remove name="AXD-ISAPI-4.0-64" />
<remove name="AXD-ISAPI-4.0" />
<remove name="AboMapperCustom-27080" />
<remove name="AboMapperCustom-27079" />
<remove name="AboMapperCustom-27078" />
<remove name="AboMapperCustom-27077" />
<remove name="AboMapperCustom-27076" />
<remove name="AboMapperCustom-27075" />
<remove name="AboMapperCustom-27074" />
<remove name="AboMapperCustom-27073" />
<remove name="AboMapperCustom-27072" />
<remove name="AboMapperCustom-27062" />
<add name="AXD-ISAPI-4.0" path="*.axd" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" resourceType="Unspecified" requireAccess="Script" preCondition="classicMode,runtimeVersionv4.0,bitness32" />
<add name="AXD-ISAPI-4.0-64" path="*.axd" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" resourceType="Unspecified" requireAccess="Script" preCondition="classicMode,runtimeVersionv4.0,bitness64" />
<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</handlers>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
比较两个配置文件并确保它们匹配,当然,它们的连接字符串应该有所不同,具体取决于您是否使用某种类型的开发数据库。
您可能会在本地计算机上的 Web 配置文件上看到程序集标记,并且生产服务器上的 Web 配置文件上也需要有该标记。
你的程序集看起来像这样:
Compare both config files and make sure they match, except of course where they should differ in connection strings depending on if you're using some type of development DB.
You'll probably see an assemblies tag on the web config file on your local machine and that needs to be also on your web config file on the production server.
Your assemblies would look something like this:
这有点猜测,但如果它不在 web.config 中并且不在代码中,则可能是 bin 目录中的项目不匹配。
我使用ajax framweork,我的bin目录中有所有这些资源dll。
This is somewhat of a guess, but if it's not in web.config and not in the code, it could be a mismatch of items in the bin directory.
I use the ajax framweork, and my bin directory has all these resource dlls.