Results 1 to 10 of 10

Thread: Adding reference to web service creates build problem

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2006
    Posts
    589

    Adding reference to web service creates build problem

    I have a number of .Net web sites built in VS2010 using Framework 4.0that reference a web service to send emails.

    My most recent site I created as a web application as opposed to a web site. In the Solution Explorer you can add a 'Service Reference' and, if you click the Advanced button you can then add a reference to a web service.

    I did that and now the (web application) site won't build - it says it cannot load the Ajax dll. If I remove the reference to the web service, the site builds okay - if I add the reference back in, the site will not build.

    Hmmm, do I need to abandon the idea of using a 'Web Application' and turn it into a 'Web Site'?

    Thanks for any help.

  2. #2
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Adding reference to web service creates build problem

    Quote Originally Posted by Webskater View Post
    Hmmm, do I need to abandon the idea of using a 'Web Application' and turn it into a 'Web Site'?
    You certainly shouldn't need to, no.

    If you add the service reference to a Web Site Project, does it work? Is there anything in the web methods that you are exposing that takes a dependency on something in the AJAX Dll?

    Gary

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2006
    Posts
    589

    Re: Adding reference to web service creates build problem

    Quote Originally Posted by gep13 View Post
    If you add the service reference to a Web Site Project, does it work?
    Gary
    Yes, the web service is currently used by 4 web site projects

    Quote Originally Posted by gep13 View Post
    Is there anything in the web methods that you are exposing that takes a dependency on something in the AJAX Dll?

    Gary
    The web methods take a single parameter - an EmailID - which is used to retrieve the data for the email (subject, message, list of recipients etc.) from a database and which then sends the emails using SmtpClient

    The only reference to Ajax I can see is this (which is put there by default when you create the web service in Visual Studio):
    Code:
    //To allow this web service to be called from script, using ASP.NET AJAX, uncomment the following line.
    [System.Web.Script.Services.ScriptService]
    In the applications that call the web service - the call is done in a btnSendEmail_Click event.

    The data is saved to the database and the web service is called by doing this:

    Code:
    CPWebService.Service1 myMailService = new CPWebService.Service1();
    myMaiilService.SendEPMailsAsync(EmailID);

  4. #4
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Adding reference to web service creates build problem

    Ok, you shouldn't "have" to do this, but if you add a reference to the Ajax DLL in the Web Application, does it then build?

    Gary

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2006
    Posts
    589

    Re: Adding reference to web service creates build problem

    Quote Originally Posted by gep13 View Post
    Ok, you shouldn't "have" to do this, but if you add a reference to the Ajax DLL in the Web Application, does it then build?

    Gary
    The web application project uses Ajax so there is a reference to the Ajax dll in the web application.

    Just for a laugh I added a reference to the Ajax dll in the web service and published it again - made no difference though. So have removed that reference from the web service.

  6. #6
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Adding reference to web service creates build problem

    I am lost to explain what is going on, sorry.

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2006
    Posts
    589

    Re: Adding reference to web service creates build problem

    Quote Originally Posted by gep13 View Post
    I am lost to explain what is going on, sorry.
    Thanks for having a look - I'll have to start with a new Hello World web service and see if adding a reference to that prevents my web application from building.

    At times like this - I yearn for the old days of asp. Life seemed a lot more simple then.

  8. #8
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Adding reference to web service creates build problem

    That is a good plan. Back to basics, and work from there.

    Ha ha, I know what you mean. However, if I never see another Classic ASP application, it will be too soon

    Gary

  9. #9

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2006
    Posts
    589

    Re: Adding reference to web service creates build problem

    Quote Originally Posted by gep13 View Post
    That is a good plan. Back to basics, and work from there.

    Ha ha, I know what you mean. However, if I never see another Classic ASP application, it will be too soon

    Gary
    I've still got one running, used by quite a lot of businesses - that I have to support and develop. Sometimes I don't touch it for months at a time, then, when I need to do something I think 'oh, no, back to debugging with Response.Write and Response.End' .... then, I make a few changes, click 'Save' and refresh the browser .... wow, no building, no 'build errors', no waiting forever for a build to take place ... hmmm, it had its merits too.

    And you never seemed to get these weird inexplicable things you get in .Net sometimes.

  10. #10
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Adding reference to web service creates build problem

    It's a tough one, I agree.

    ASP.Net has it's problems, but then so does Classic ASP. You are working/adding to an existing application, that you know and understand. Can you imagine creating a new ASP application, from scratch, without all the stuff you now take for granted in the .Net World?

    Gary

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width