I wish to make our web server perform "double duty"... One as a web application... The other as a web service. Http://Server should perform as a web application (as it always had). Http://Server/ServicePath/ServiceName.asmx should perform as a web service. When I include the NameSpace, the build returns the following error (See ServiceName.asmx, first attempt):
Could not create type 'NameSpace.ServiceName'.
When I did not include NameSpace, the build returned the following error (See ServiceName.asmx, second attempt)...
Could not create type 'ServiceName'
What am I doing wrong?
ServiceName.asmx, first attempt
<%@ WebService Language="VB" CodeBehind="*ServiceName*.asmx.vb" Class="*NameSpace*.*ServiceName*" %>
ServiceName.asmx, second attempt
<%@ WebService Language="VB" CodeBehind="*ServiceName*.asmx.vb" Class="*ServiceName*" %>
Imports System.Web.Services Imports System.ComponentModel Namespace *WebApplication*.*WebServices* ' First attempt. Also commented out on the second attempt ' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. ' <System.Web.Script.Services.ScriptService()> _ <System.Web.Services.WebService(Namespace:="http://*OurDomain*/")> _ <System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _ <ToolboxItem(False)> _ Public Class *ServiceName* Inherits *OtherNameSpace*.*OtherServiceName* End Class End Namespace ' First attempt. Also commented out on the second attempt
I have exhausted every trick I know. I have run out of ideas. I hope someone can help me.
One thing I did find interesting... After a Rebuild Solution, NameSpace.ServiceName (or ServiceName when NameSpace is not used) would appear in the Object Browser after searching for ServiceName. It would display the following upon clicking ServiceName (See below). If one were to click NameSpace (or WebApplication when NameSpace is not used) below, it would "jump" to WebApplication, but it would NOT be listed under it. Where IS it listed?
Public Class ServiceName
Member of NameSpace (or WebApplication when NameSpace is not used)
Note: Server, ServerPath, ServiceName, OtherServiceName, NameSpace, OtherNameSpace, WebApplication and OurDomain, and when they are surrounded by asterisks ("*"), are placeholders for their corresponding values. They are NOT the actual values.
I finally found where NameSpace (or ServiceName when NameSpace was not used) was listed in the Object Brower. There is actually TWO instances of the WebApplication listed in the Object Browser... One containing all the classes (except mine)... Another one containing my class ONLY. When I clicked on NameSpace (or WebApplication when NameSpace was not used), it would “jump” to the FIRST instance of the already expanded WebApplication, where my class was NOT listed. It was not until I collapsed the first instance of WebApplication that I "discovered" the second instance. Therein was my class. This, however, does not resolve my problem. Question: How do I properly reference my class in the SECOND instance of WebApplication in my ASMX file?