locked
when adding web reference, I get "Operation is not valid due to the current state of the object." RRS feed

  • Question

  • User1004736368 posted

     Hello.

    I am trying to add a Web reference to a project.  So, I do the standard: right clicking on the project and select "Add Web Reference". The Add Web Reference appears and I navigate to the desired URL "http://ws.melissadata.com/dqws/Address.asmx" and click "Go".   This works in IE.  I see the results and two methods in the window.  However,  the "Add Reference" button and " Web Reference Name" texbox is disabled. And, I see the Operation is not valid due to the current state of the object." I think this is a proxy and or firewall issue?

     

    I know the System.Net.WebProxy("corp-xxx-proxy.xxx", 8080);  and System.Net.NetworkCredential("xxxx", "xxxx"); [x replaces real values]

     Any ideas where I can set this info so I will be able to use the "Add Web Reference" wizard?  - OR - Is there a workaround?

     

     

    thanks

    Wednesday, October 8, 2008 3:03 PM

Answers

  • User1071970124 posted

    I've never heard this one before. I'm surprised that Visual Studio doesn't simply use the same default proxy that IE uses.

    One possibility is that the proxy configuration on your system has been changed in machine.config or the web.config in C:\Windows\Microsoft.Net\Framework\V2.0.whatever\CONFIG. Visual Studio would be paying attention to that value, but IE would be using the Windows default.

    I would also try rebooting the system and doing it again, just in case.

    Worse come to worst, break out Microsoft Network Monitor (from http://www.microsoft.com/downloads/details.aspx?FamilyID=f4db40af-1e08-4a21-a26b-ec2f4dc4190d&DisplayLang=en) and watch the traffic, both of Visual Studio, and of IE. Compare and contrast. ;-)

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, October 8, 2008 3:22 PM

All replies

  • User1071970124 posted

    I've never heard this one before. I'm surprised that Visual Studio doesn't simply use the same default proxy that IE uses.

    One possibility is that the proxy configuration on your system has been changed in machine.config or the web.config in C:\Windows\Microsoft.Net\Framework\V2.0.whatever\CONFIG. Visual Studio would be paying attention to that value, but IE would be using the Windows default.

    I would also try rebooting the system and doing it again, just in case.

    Worse come to worst, break out Microsoft Network Monitor (from http://www.microsoft.com/downloads/details.aspx?FamilyID=f4db40af-1e08-4a21-a26b-ec2f4dc4190d&DisplayLang=en) and watch the traffic, both of Visual Studio, and of IE. Compare and contrast. ;-)

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, October 8, 2008 3:22 PM
  • User1004736368 posted

     OK, I  think I am going to be sick.... :)

    Even though I tried multiple web service sites, I still come up with the same message.  However, I thought of trying HTTPS rather than HTTP in the URL and now it works.  Probably some kind of proxy security.

    Thanks and I will mark your answer as correct

    Wednesday, October 8, 2008 3:49 PM
  • User1071970124 posted

    Are you using some VPN software or other network software that has a presence on your machine? I've heard of some VPN software that actually looks to see what programs you're running before deciding to permit you access. This software may not understand that Visual Studio is a legitimate user of the HTTP protocol.

    Wednesday, October 8, 2008 3:51 PM
  • User1004736368 posted

     When trying to add a Web reference, I get the popup proxy server modal login screen to supply a userName and Password (remember my password).  That is why I think there is some kind of secuirty issue going on.  who knows what they set on your machine and what is on the firewall.  Heck!  Plus, I wouldn't even begin to know where to look for these network employees within my own company!

    Wednesday, October 8, 2008 5:03 PM
  • User1071970124 posted

    Here's a thought. Let's say for a moment that there's some piece of software that doesn't want to treat VS like IE, or wants to pop up security when VS does HTTP. Try using View->Other Windows->Web Browser. Try typing the web service URL into the address bar of the resulting window. If the security pop-up comes up, put in your username and password and say "remember me". Then, as a test, exit VS and start it again, and view the web browser again, and put in that URL. See if it prompts again.

    In either case, next try the Add Web Reference after having logged in through the browser window.

    Wednesday, October 8, 2008 5:10 PM
  • User1004736368 posted

     I tried your suggestion, but still not able to get the HTTP version to work.  I don't know if its related, but I also was never able to get the the help online option to work either.

    Thursday, October 9, 2008 10:24 AM
  • User-1411299833 posted

    Hi, 

    Go to your application's web config/ app config and add the following under the <configuration> element:

    <system.net>

    <defaultProxy>

    <proxy usesystemdefault="True" proxyaddress=http://someproxy:someport bypassonlocal="True"/>

    </defaultProxy>

    </system.net>

    Monday, November 24, 2008 11:09 AM
  • User491405965 posted

    if u specify proxy server in your web browser Internet Options then uncheck the box => "Automatically detect settings".

    i am using IE and it worked for me.

    Regards,

    Imtiyaz

     

    Tuesday, October 5, 2010 7:06 AM
  • User-521982019 posted

    Hi.  I went searching the net on this one and came across this link.  I'm using Visual Studio 2008 and following the step from gauravmahajan fixed my issue (the above step didn't)

    One other thing though.  In my code I needed to add this in order to use the web service:

    var Handle = new ExceptionLogger_Web.ExceptionLogger();
    var NWC = System.Net.CredentialCache.DefaultNetworkCredentials;
    var pry = new System.Net.WebProxy("YOUR.PROXY.SERVER", YourPort);
    pry.Credentials = NWC;
    Handle.Proxy = pry;
    TextBox.Text = Handle.HelloWorld();
    Monday, February 6, 2012 1:42 AM
  • User-670221389 posted

    Hi Gaurav,

    Thanks for this. It worked.

    Thursday, March 21, 2013 1:24 AM