Solved

How is an .ASMX Generated by VB.NET?

Posted on 2010-11-10
7
697 Views
Last Modified: 2012-08-14
Here is what I so far know:

1- add this code to each web service class:

Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols

' <System.Web.Script.Services.ScriptService()> _
<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class AdminBudget
    Inherits System.Web.Services.WebService

2-set-up web service methods like so:

    <WebMethod()> _
    Public Function PositionPerPositionCD(ByVal strPositionsCD As String) As String()

3- create a .ASMX using the class name:

VB.NET genrates this:
<%@ WebService Language="VB" Class="AdminBudget" %>

On-line help states it should be this:
<%@ WebService Language="VB" Codebehind="AdminBudget.asmx.vb" Class="AdminBudget" %>

(not certain of which is correct)

As far as I was informed by a co-worker, all that is left is building the project. However, the .ASMX file remains empty outside of the above directive.

What am I missing? My co-worker is not here and I need to finish this by this coming Monday (11-15). Any help will be appreciated. Thank you.

-Bob
0
Comment
Question by:bobcann
  • 3
  • 3
7 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 34111942
What I would suggest is to create a new "Hello World" web service from the project template, and look at what the template generates, and compare to what you need for your web service.
0
 
LVL 21

Assisted Solution

by:Craig Wagner
Craig Wagner earned 150 total points
ID: 34111947
The ASMX file should be empty outside of that directive. The code goes in the code-behind file.

The directive from the on-line help is correct.

Rather than creating these files from scratch, why don't you just right-click on the project in Solution Explorer, Add->New Item->Web->Web Service and let it generate all the stub files? If, for some reason, that option isn't available, as an alternative you could use File->New Project->Web->ASP.NET Web Service Application and then copy the generated stub files into your project. Hand-crafting these files isn't necessary when Visual Studio will generate them for you.
0
 

Author Comment

by:bobcann
ID: 34121875
Hi Guys,

This is what is in the VB generated .asmx file.

<%@ WebService Language="VB" Codebehind="AdminBudget.vb" Class="AdminBudget" %>

It did not work. The file name was changed from "Codebehind="AdminBudget.vb" to "Codebehind="AdminBudget.asmx.vb" altering it to ".asmx.vb"

<%@ WebService Language="VB" Codebehind="AdminBudget.asmx.vb" Class="AdminBudget" %>

When I build the project the asmx files are not populated with code as my co-worker explained (not at work today).

What am I missing. Thanks again for your help!

-Bob
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 96

Expert Comment

by:Bob Learned
ID: 34122457
Are you able to attach a screen cast of your problem?
0
 

Author Comment

by:bobcann
ID: 34123871
TheLearnedOne, as I was creating a Screncast, I believe I found my error. It was explained by my co-worker that by simply Building the project would create the appropriate Service files. Out of ingnorance, I did so.

However, this time I selected Build > Publish Web Site and it asked for a directory to place the files in. It all seemed to work just fine.

One last question, the .asmx files only contain the directive:

<%@ WebService Language="VB" Codebehind="AdminBudget.asmx.vb" Class="AdminBudget" %>

Is this correct that it only contains this single line of code?

The client programmer will not be in until Monday and he is needed to test the function of the completed Web Service.

Again, thank you for the help.

-Bob
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 350 total points
ID: 34127834
All the heavy lifting, in a web service, is in the code-behind, so the .asmx file only needs to declare that class for the ASP.NET parser.
0
 

Author Closing Comment

by:bobcann
ID: 34138482
Thanks for the help.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Hide Tab Page 3 34
Round up to 100% in .NET 10 87
Saveas need to save a copy 16 26
Variable Event ? 3 23
This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now