Unable to add a secure web reference in VS.Net 2010 - visual-studio-2010

Background: I've been tasked with creating a single sign on solution which will redirect our internal users to a vendor's web application. I've set it up as an ASP.Net project which will call a web service provided by the vendor. This service will return a URL and a token to be used to sign in to the vendor's site. All this is to be done securely.
Problem: When using Visual Studio's Add Web Reference dialog to download the WSDL and generate the required proxy class, I get the following error:
There was an error downloading
'https://server:port/folder/Service?wsdl'. The
underlying connection was closed: An unexpected error occurred on a
send. Authentication failed because the remote party has closed the
transport stream. Metadata contains a reference that cannot be
resolved:
'https://server:port/folder/Service?wsdl'. An
error occurred while making the HTTP request to
https://server:port/folder/Service?wsdl. This
could be due to the fact that the server certificate is not configured
properly with HTTP.SYS in the HTTPS case. This could also be caused by
a mismatch of the security binding between the client and the server.
The underlying connection was closed: An unexpected error occurred on
a send. Authentication failed because the remote party has closed the
transport stream. If the service is defined in the current solution,
try building the solution and adding the service reference again.
In addition to this error, the Add Reference button is grayed out, preventing me from adding the reference and generating the proxy class.
The project is running under .Net Framework 4.0. I've downloaded and installed the necessary client keys/certificates correctly. I've added the IP address and server name to the hosts file and added both to the proxy bypass list. I can browse to the endpoint and view the WSDL in IE and VS's web browser. I can even view the WSDL in the Add Web Reference dialog box in VS. In each case, I'm prompted to select which certificate to use, which I do.
I do not have access to the web service itself or the server it is located on.
I've spent many hours on Google, but have not been able to find a resolution. Any ideas?

Worked around the issue by downloading the WSDL and pulling it into VS through the Add Web Reference dialog by referencing the URL file:\\\drive:\pathname\filename.wsdl.

Related

WSDL Authentication Error Appearing on web reference connection

When adding a web reference to a visual studio 2019 web service project I am getting the following errors:
" - The underlying connection was closed: An unexpected error occurred on a send.
Authentication failed because the remote party has closed the transport stream."
and
"The custom tool 'MSDiscoCodeGenerator' failed. Unable to import binding 'Soap11' from namespace http*****"
The server offer three webservices, first web service worked perfectly no issues. The second brings up these errors.
I suppose my question is, seeing as this looks like configuration on the third parties end, is this a visual studio error?
All WSDL offerings from the server work perfectly in the browser and in SOAPUI

Visual Studio webdeploy fail even when connection is validated?

I am trying to deploy my webapp VS2015 RC1 DNX 451. Even when I validate connection and run publish I get error
Severity Code Description Project File
Error Error Code: ERROR_USER_UNAUTHORIZED
Error More Information: Connected to the remote computer ("crocus.arvixe.com") using the Web Management Service, but could not authorize. Make sure that you are using the correct user name and password, that the site you are connecting to exists, and that the credentials represent a user who has permissions to access the site. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_USER_UNAUTHORIZED.
Error Error: The remote server returned an error: (401) Unauthorized.
Googling the issue and even trying to view host forum just says make sure username and password is correct. I am getting nowhere trying various settings. Any ideas how to debug the issue?
I am using Arvixe.com as host.
You should contact Arvixe.com. They likely have some odd configuration on their servers but I would suspect they can help you resolve the issue.
Arvixe does not support Web Deploy anymore. Once they move you to their new servers Web Deploy won't be available to you. In Visual Studio you can set up a Publish with FTP instead of Web Deploy. If you're used to Web Deploy publishing your database changes, then you'll need to do those yourself with SQL scripts. Entity Frameworks has an option to produce a SQL script for a migration, so you can use that to publish your EF database changes.

Cannot add web service reference to VS2008, works in VS2010

I’m having trouble adding a reference to an HTTPS web service using Visual Studio 2008, it works fine in Visual Studio 2010 but in VS2008 I get the below error.
Our IT guys tell me that the problem is that VS2008 is not using the IE proxy settings properly so the HTTPS request is getting sent to the HTTP proxy, which always denies all HTTPS requests. However, in VS2010 it works just fine.
They don't know how to fix this if that is indeed the problem.
(As an aside, I have to use VS2008 because I want to use this in an SSIS Script Task, however I've been testing this in a blank console app.)
There was an error downloading 'https://xxxxxxxxxxxx.asmx'.
The operation has timed out
Metadata contains a reference that cannot be resolved: 'https://xxxxxxxxxxxxx.asmx'.
An error occurred while making the HTTP request to https://xxxxxxxxxxxxxxxxxxx.asmx. This could be due to the fact that the server certificate is not configured properly with HTTP.SYS in the HTTPS case. This could also be caused by a mismatch of the security binding between the client and the server.
The underlying connection was closed: An unexpected error occurred on a send.
Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
An existing connection was forcibly closed by the remote host
If the service is defined in the current solution, try building the solution and adding the service reference again.
This appears to be a bug in Visual Studio.

WebDeploy - just can't get it to work

I've installed Web Deploy 2.1 on a Server 2008 R2 running under VMWare.
In the IIS Manager (Management Service applet) I can see that "Enable Remote Connections" is checked and the port is set to 8172. Under "IIS Manager Permissions" I've added my Windows account (CORP\ekkis) and under the "Authentication" applet (for IIS) I have enabled "Windows Authentication".
I've also turned off the firewall.
So from the command line I test the system to work like this:
C:\Program Files\IIS\Microsoft Web Deploy V2>msdeploy -verb:dump -source:contentPath=\temp,wmsvc=192.168.0.70,username=CORP\ekkis,password=MyPass,authType=Basic -allowUntrusted=True
and get this:
Info: Using ID '9b954a0f-ff07-4e77-ba2c-d27472f5fda0' for connections to the rem
ote server.
Error Code: ERROR_USER_UNAUTHORIZED
More Information: Connected to the destination computer ("192.168.0.70") using t
he Web Management Service, but could not authorize. Make sure that you are using
the correct user name and password, that the site you are connecting to exists,
and that the credentials represent a user who has permissions to access the sit
e.
Error: Object of type 'contentPath' and path '\temp' cannot be created.
Error: The remote server returned an error: (401) Unauthorized.
Error count: 1.
I've also tried deploying with Visual Studio 2010 from the host OS with the following service urls (I haven't found proper documentation on how to form this url):
https://192.168.0.70/
https://192.168.0.70:8172/
https://192.168.0.70:8172/MsDeployAgentService/
https://192.168.0.70/MsDeployAgentService/
I've tried the non-secure versions as well but just cannot get it to work. What is the correct format for the url? and what permissions am I missing?
the errors from VS have varied depending on how I attempt it but below is a sample:
Could not complete the request to remote agent URL 'http://192.168.0.70:8172//MSDEPLOYAGENTSERVICE'.
The underlying connection was closed: An unexpected error occurred on a receive.
Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
An existing connection was forcibly closed by the remote host
Publish failed to deploy.
there really should be a guide out there to do this (yes, I've googled myself blue in the face)!
thanks - ekkis
ok, I've figured out that the correct url is:
https://192.168.0.70:8172/MsDeploy.axd
and that having the "Windows Authentication" enabled doesn't seem to make a difference. Also, having my account in the "Managers" list doesn't seem to make a difference either.
so the back end was all working fine (I've turned off the Web Deployment Agent Service). it was just the url I had wrong.

ClickOnce Not Obeying Installation Folder for Localhost

I'm testing a ClickOnce application deployment. I have setup a virtual directory on my machine (running IIS). I have specified http://localhost/SampleApplication as the Installation Folder URL in the Publish tab of Visual Studio. However, when I publish the application I get the following error:
Warning: Files could not be downloaded
from http://chrish/SampleApplication/.
The remote server returned an error:
(407) Proxy Authentication Required.
Publish success.
Warning: Unable to
view published application at
http://chrish/SampleApplication/publish.htm.
http://chrish/SampleApplication/publish.htm
Notice how it has changed my url from Localhost to my login name. Why? This wasn't happening a week ago.
ClickOnce installation involves verifying that the server name matches the expected name. Thus localhost always gets translated under the covers to the computer name [not the username as you suggest in your question] (one of many confusing things ClickOnce does - one side effect of this is that if you want to set up 3 download servers, you need to do 3 separate publishes and/or script the publish like this) or like this. So this is not a surprise - it's always doing that under the covers.
The 407 error relates to proxy auth. This implies downloading is being diverted via a proxy such as Microsoft ISA Server. Have a look in your IE Internet Options Connections Proxy Settings and make sure its bypassing for local addresses [such as chrish].
The reason it's reporting success is that the upload likely uses an alternate mechanism than the verification does and isn't being routed via / blocked by the proxy. (The underlying problem is that the .NET framework does not by default pass proxy credentials and you'd need to either apply a config entry for devenv or whatever does the publish or have the build process call a test step with extra code that does send the proxy credentials](http://blogs.msdn.com/jpsanders/archive/2009/03/24/httpwebrequest-webexcepton-the-remote-server-returned-an-error-407-proxy-authentication-required.aspx). See also How should I set the default proxy to use default credentials?)
ClickOnce doesn't like "localhost", but you can work around that.
If you set the Publishing Folder Location to:
C:\inetpub\wwwroot\SampleApplication\
and the Installation Folder URL to:
http://chrish/SampleApplication/
(where "chrish" is the network name of your computer) then you can publish locally.

Resources