?
Solved

Unable to add a web reference to C#.NET desktop application

Posted on 2009-02-16
4
Medium Priority
?
883 Views
Last Modified: 2012-05-06
My company made a very large set of changes to over 500 databases and lots of applications and web services over the weekend, having to do with tightened security on web service access.  Suddenly I find myself unable to compile an application that used to work.

In my solution, I have an application project and a web service.  When I build just the web service, it builds with no errors.  When I go to add a web reference to that service into my application project, it throws this error:

"The type of page you have requested is not served because it has been explicitly forbidden.  the extension '.asmx' may be incorrect"

I have a couple of dozen applications that I am supporting, and most of them still compile just fine, *including* one which has a reference to this same web service.  So I must conclude that the problem is in the solution/project, not the web service.

Can anyone give me an idea of where to look for the problem?
0
Comment
Question by:FrancineTaylor
  • 2
4 Comments
 
LVL 7

Accepted Solution

by:
talker2004 earned 2000 total points
ID: 23654384
If this was happening to me, I would start doing process of elimination kind of stuff.

OK, so you said you have another application which is referencing the web service fine. Perhaps the solution referencing the web service has some type of problem.

Ok, make a hello world web service and try to reference it from the problem application. Did it work?

Also have you tried creating the web reference from the command line. This is the way we do it, works great. It so much less of a headache for me.

Here is an example of how we do it. It's so much easier to reference an actual code file in your application. When changes are make to the web service you simply run a batch file and it updates the source file.
 
"C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\wsdl" /language:C# /out:OurWebSite\App_Code\MyWebServiceProxy.cs http://localhost/MyWebService/MyWebService.asmx?WSDL
 
0
 
LVL 6

Expert Comment

by:ViceroyFizzlebottom
ID: 23654393
Have you tried deleting the web reference and then adding it again? I know this solved 70% of the issues I have with adding web references.
0
 
LVL 7

Expert Comment

by:talker2004
ID: 23654408
Also what happens if you browse to the url from the develoment machine. Does it come up? If so are you able to get the WSDL from your web browser? Try it by adding ?WSDL to the end of the url.

http://localhost/MyWebService/MyWebService.asmx?WSDL
 
0
 
LVL 1

Author Comment

by:FrancineTaylor
ID: 23654419
Yes, actually, deleting the web service and trying to re-add it was what caused the error.
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

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

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This video tutorial shows you the steps to go through to set up what I believe to be the best email app on the android platform to read Exchange mail.  Get the app on your phone: The first step is to make sure you have the Samsung Email app on your …
Free Data Recovery software is an advanced solution from Kernel Tools to recover data and files such as documents, emails, database, media and pictures, etc. It supports recovery from physical & logical drive after a hard disk crash, accidental/inte…
Suggested Courses

588 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