I add a handler mapping to IIS7 (on Win7). It runs just fine until I publish a new build to http://localhost. Once I publish a new build, all the mappings I added are magically gone!!
[EDIT]
I am also losing all of my virtual directories during a publish.
[/EDIT]
Any tips/tricks for this?
The handlers are now stored in the app's web.config instead of in the metabase. Because of that, if you copy out an old copy of the web.config, your changes are lost.
Look at the system.webServer element of your web.config. One of mine looks like:
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules>
<add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</modules>
<handlers>
<remove name="WebServiceHandlerFactory-Integrated"/>
<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>
Related
I have a web.config file which contains
<system.web>
<httpHandlers>
<add verb="*" path="*.pdf" type="InfomationDev.Info.write.writeModule, InformationDev.Info.write"/>
</httpHandlers>
</system.Web>
**After running appcmd migrate command IIS6 to IIS7 we got new section**
<system.webServer>
<handlers>
<remove name="WebServiceHandlerFactory-Integrated"/>
<remove name="ScriptHandlerFactory" />
<remove name="ScriptHandlerFactoryAppServices" />
<remove name="ScriptResource" />
<add name="*.pdf" verb="*" path="*.pdf" type="InfomationDev.Info.write.writeModule, InformationDev.Info.write"/>
<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" />
The problem is:
if I removed completely hhtpHandlers section it is working in Integrated mode.
if I removed completely system.webserver section it is working in Classic mode.
If I wanted to work on both modes(sometimes classic & Integrated) so I added both sections as shown above throwing exception 500 Internal server error.I want to work
in both Integrated & classic modes without using
validateIntegratedModeConfiguration="false".
How can we do that?
I have a virtual directory (configured as an application). It will accept requests for all files that exist, but it will not call handlers (system.web/httpHandlers).
Any ideas?
<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"/>
<add verb="GET" path="*.smjs" type="SmartMax.SightMax.AgentInterface.JSHandler, SmartMax.SightMax.AgentInterface, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b9f7c69b7e2ca2dc"/>
<add verb="GET" path="*.smgif" type="SmartMax.SightMax.AgentInterface.GifHandler, SmartMax.SightMax.AgentInterface, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b9f7c69b7e2ca2dc"/>
</httpHandlers>
this is the url that the application uses.
http://www.datalineonline.com/SightMaxAgentInterface/chat.smgif?accountID=1&siteID=1&queueID=2
With IIS6, i think you have to map the two extensions smjs/smgif to the .net framework. Which i think is C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll, well the same one that aspx is mapped to anyway. Otherwise IIS just rejects the requests.
Or you can map all requests to asp.net
https://serverfault.com/questions/102695/iis6-wildcard-mapping-to-asp-net-no-file-extension-results-in-iis-404
When I moved my website over to another server I've noticed now that ajax doesn't appear to be working.
When I remote desktop to the server and go to the url on the server i.e. http://myserver/mywebsite ... everything works ok.
When I open up the website in visual studio on the server it works as no problem as well.
It's only when I connect remotely that the 'javascript' error occurs.
To my web.config I've added:
<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>
I've tried
<compilation debug="false"/>
and tried emptying web history and still no luck.
Any ideas?
Try this: http://blogs.telerik.com/blogs/posts/10-03-16/common_reasons_for_the_lsquo_sys_is_undefined_rsquo_error_in_asp_net_ajax_applications.aspx
The other conputer has another IIS Version (or AppPool integrated mode) installed. AJAX needs to be configured in the web.config file as you write above, but in IIS 7 it's in System.WebServer. I could give you a working sample for the two configured in the same file if i was at home and not in the train to home ;-) Anyway, you can get a correct Web.config file if you create a new web application with visual studio 2010.
Edit:
Copy this to the bottom of your web.config file:
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules>
<!--
<add name="WebServiceAuthenticationModule" preCondition="integratedMode" type="WebServiceAuthenticationModule.WebServiceAuthenticationModule, WebServiceAuthenticationModule" />
-->
<add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</modules>
<handlers>
<remove name="WebServiceHandlerFactory-Integrated" />
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode"
type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode"
type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.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=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</handlers>
</system.webServer>
The only other reason for sys not defined is if you have no scriptmanager on the page where you use AJAX.
Sys is the JavasScript class which provides all the static functions for .NET AJAX calls.
And make sure the assembly System.Web.Extensions.dll is present on the other computer (or set localcopy to true).
I have a question about a third-party DateTimePicker control.
I've downloaded the dll and paste the appropriate web.config lines.
I've put the control into the aspx page. When I load the page an alertbox appears:
No «add verb="GET" path="/JavascriptDateTimeFormat.axd" /» httpHandler.
The control's textbox and the buttons are present but does nothing.
Part of my web.config is:
<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" />
<add tagPrefix="mark" assembly="Mark.Web.UI.WebControls.DateTimePicker" namespace="Mark.Web.UI.WebControls"/>
</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" validate="false" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add verb="GET" path="/helpdeskweb/JavascriptDateTimeFormat.axd" type="Mark.Web.UI.JavascriptDateTimeFormat, Mark.Web.UI.WebControls.DateTimePicker"/>
</httpHandlers>
What should I do?
Just omit the name="JavascriptDateTimeFormat" and everything should work. The added line in IIS7 is:
<add verb="GET" path="JavascriptDateTimeFormat.axd"
type="Mark.Web.UI.JavascriptDateTimeFormat, Mark.Web.UI.WebControls.DateTimePicker"/>
Alexander
If this is for IIS7, you need to change it slightly. In this case, you need to put the following line in the section of the subsection:
<add name="JavascriptDateTimeFormat" verb="GET" path="JavascriptDateTimeFormat.axd" type="Mark.Web.UI.JavascriptDateTimeFormat, Mark.Web.UI.WebControls.DateTimePicker"/>
It's nearly the same, but the syntax and location is slightly different.
He didn't specify, but you need to put it in the
<handlers>
This is the complete solution to this problem.
It's best to have sections for IIS6 AND IIS 7:
<configuration>
<system.webServer>
<handlers>
<add name="JavascriptDateTimeFormat" verb="GET" path="JavascriptDateTimeFormat.axd" type="Mark.Web.UI.JavascriptDateTimeFormat, Mark.Web.UI.WebControls.DateTimePicker"/>
</handlers>
</system.webServer>
<system.web>
<httpHandlers>
<add verb="GET" path="/JavascriptDateTimeFormat.axd" type="Mark.Web.UI.JavascriptDateTimeFormat, Mark.Web.UI.WebControls.DateTimePicker"/>
</httpHandlers>
</system.web>
</configuration>
Add this entry into web.config between HttpHandlers tag
add verb="GET" path="JavascriptDateTimeFormat.axd" type="Mark.Web.UI.JavascriptDateTimeFormat, Mark.Web.UI.WebControls.DateTimePicker"
make sure the path is as mention in bold.
I have a small web application with ASP.NET AJAX running well under the Cassini ASP.NET from http://www.ultidev.com/. But when I tried to host it under IIS7, the AJAX is not working. The UpdatePanel, the Calendar extension, the client side validation from the Validation Control are not working at all. I think it must be a problem of IIS 7.
Here's a section of the web.config file:
<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"/>
<add name="CrystalImageHandler.aspx_GET" verb="GET" path="CrystalImageHandler.aspx" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" preCondition="integratedMode"/></handlers>
</system.webServer>
Can anyone tell me what the problme is with IIS 7? How should I configure it to work with ASP.NET AJAX? Thank you.
Add the following line in the Handlers section in the web.config file:
<add name="Ajax" verb="POST,GET" path="ajax/*.ashx" type="Ajax.PageHandlerFactory, Ajax"/>
I just removed Web Server role and added Web Server role again. It's working now. I think maybe some component that IIS 7 was set up in the first place.
Delete the next code line if you added AJAX from NUGET and after you add ajaxcontroltoolkit.dll from
here: http://ajaxcontroltoolkit.codeplex.com/releases/view/109918
<add tagPrefix="ajaxToolkit" assembly="AjaxControlToolkit" namespace="AjaxControlToolkit"/>
PD: AJAX CONTROL TOOL KIT 4.5 NOT WORKS WITH FRAMEWORK 4.5. AND AJAX FROM NUGET HAS PROBLEM