We can create Asp .Net classes or bussiness objects inside App_Code or using compiled library .dll file in Bin folder.
Alternatively classes may be write inside WebService. If nothing is wrong then we can access our web app classes when it is launched via Visual Studio.
Unfortunately, after we deploy it to IIS and try to access deployed classes or WebService an error “Compilation error .. Type xxx is not defined ..” occurs.
Let’s make a New Website Asp .Net Empty Web Application to make problem and solution clear.
Web services are components on a Web server that a client application can call by making HTTP requests across the Web. ASP.NET enables you to create custom Web services or to use built-in application services, and to call these services from any client application
Web Services are an integral part of the .NET framework that provide a cross-platform solution for exchanging data between distributed systems. Although Web Services are normally used to allow different operating systems, object models and programming languages to send and receive data, they can also be used to dynamically inject data into an ASP.NET AJAX page or send data from a page to a back-end system. All of this can be done without resorting to postback operations.
Web Service In Code
Web Service in Asp .Net is an object that can be accessed in the same way as a class.
Website project must add Web reference to a WebService’s Url address so that the website can access it.
In code point of view, writing access to WebService is same as accessing a regular class in Asp .Net. This regular class usually located in App_Code folder.
WebService located at a web server and reference it through http protocol.
Inside WebService code file is a class and its member. We can put class member, properties and methods in WebService. We can build WebService to operate with files, database etc Continue reading