Note that there are some explanatory texts on larger screens.

plurals
  1. POWebService/ScriptService not found; System.Web.Extensions not recognized
    primarykey
    data
    text
    <p>I've created a scriptservice in my vb.net 4.0 web app (or web site... not sure which it is - does it matter?) because I want to call it from the client side. I get client errors saying my namespace is not recognized (HomepageService in the code below). I've tried qualifying it with the name configured on the project as "Root namespace", but the js says it doesn't recognize that namespace either.</p> <p>The app is old - we recently converted it from dotnet 2.1 to 4.0.</p> <p>I found the following related topic, because when I try to Import System.Web.Extensions in my HomepageServices.asmx.vb, visual studio says it doesn't recognize the thing even though i can see it, listed right there in studio under References.</p> <p>[System.Web.Extensions Assembly cannot be resolved][1]</p> <p>I tried posting a followup question to that topic, becauxse I tried following the instructions in the answer but they didn't work (I don't have a "Target Framework" in Project > Properties > Application), but someone deleted it because I guess i'm not allowed to ask followup questions? </p> <p>I've consulted various sites and followed instructions, here's an example: <a href="http://www.asp.net/ajax/documentation/live/tutorials/ConsumingWebServicesWithAJAXTutorial.aspx" rel="nofollow">http://www.asp.net/ajax/documentation/live/tutorials/ConsumingWebServicesWithAJAXTutorial.aspx</a></p> <p>Here is contents of HomepageService.asmx sitting in the root folder of my site:</p> <pre><code>Imports System.Web.Services Imports System.Web.Services.Protocols Imports System.ComponentModel Imports System.Collections.Generic &lt;System.Web.Services.WebService(Namespace:="http://localhost/appname")&gt; _ &lt;System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)&gt; _ &lt;ToolboxItem(False)&gt; _ &lt;System.Web.Script.Services.ScriptService()&gt; _ Public Class HomepageService Inherits System.Web.Services.WebService Shared _rand As Random = New Random(Environment.TickCount) &lt;WebMethod()&gt; _ Public Function Test(ByVal s As String) As Integer Return _rand.Next(0, 120) End Function End Class </code></pre> <p>Snippet from master page:</p> <pre><code>&lt;body&gt; &lt;form id="form1" runat="server"&gt; &lt;asp:ScriptManager ID="Scriptmanager1" runat="server" EnablePageMethods="true"&gt; &lt;Scripts&gt; &lt;asp:ScriptReference Path="CallWebServiceMethods.js" /&gt; &lt;/Scripts&gt; &lt;Services&gt; &lt;asp:ServiceReference Path="HomepageService.asmx" /&gt; &lt;/Services&gt; &lt;/asp:ScriptManager&gt; </code></pre> <p>and at the top of my page i import the js:</p> <p>PageRequestManager.js:</p> <pre><code>HomepageService.set_defaultSucceededCallback( OnLookupComplete); HomepageService.set_defaultFailedCallback( OnError); function OnLookup() { HomepageService.Test(stb.value); } function OnLookupComplete(result, userContext) { // userContext contains symbol passed into method var res = document.getElementById("_resultLabel"); res.innerHTML = userContext + " : &lt;b&gt;" + result + "&lt;/b&gt;"; } function OnError(result) { alert("Error: " + result.get_message()); } </code></pre> <p>My web.config is a mess, but I'll be happy to post it...</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload