"Hot-Swapping" Web Service References in Visual Studio - c#

I've recently written prototype code that consumes a commercial web service that is hosted on ServerA.
I've added the reference through Visual Studio, written some code that calls a few exposed functions from the service and everything works great.
I'm now trying to change the reference to that web services to another URL, to target another server, ServerB. I BELIEVE the services on these two machines are the same.
However:
ServerA runs some version of the application which includes the deployed web service.
ServerB runs a different version of the application which includes the deployed web service.
Both WSDL contents are identical, the namespace addresses between the two are identical (the target namespace URLs are the same[note that the URLs both reference an external address e.g. http://google.com/services/whatever/]), but my prototype code only works when I reference the web service from ServerA.
I throw a "Fault occurred while processing." exception whenever calling an exposed function on ServerB. From my understanding this is an unhandled exception that is thrown server-side and it does not give me much info to debug.
If these web services were truly identical, would swapping out the endpoint URL in my application configuration be enough to switch references between the two web services or am I grossly misunderstanding something?

Related

Get 404 error while retrieving metadata only using dotnet-svcutil

Well, the problem is very strange, I have a WCF service served on a production environment with .Net framework 4.5.2, it's working well on the related WPF client.
And now, I'm coding on a test project using .Net 5, and this WCF server is running on localhost for convenience, the WPF client on it is also on local, the URL of WCF service is like http://localhos:port/Services/XXXXX.svc and on https, works fine in the WPF client, and of course, can both access normally on browser, and using Visual Studio Connected Services I can retrieve the services from both URL as well. But the strange thing is, if I use dotnet-svcutil to retrieve the service, it returns Http error 404 and can't generate client code, but if use svcutil from dotnet framework 4.8, it retrieves metadata and generate the code perfectly.

WPF Desktop and web service in same solution

I am revising .NET and web services and attempting to test calling the web service I created with a WPF desktop application. The web service builds and runs fine and when I start without debugging in VS Community 2017 it works as expected and I can see the web service end points in the browser along with the WSDL. But when I attempt to add a WPF desktop application and start without debugging to the browser does NOT have the .asmx file in the URL anymore and states -
HTTP Error 403.14 Forbidden
the web server is configured to not list the contents of this directory
I have googled this error and tried several of the suggested fixes but none of them have resolved the issue. Can this be done at all or do I have to publish the web service to IIS Express on its own and have the WPF desktop application on its own? Its just that it would be very useful to have a desktop application within the same solution to code and test

asp.net web.config test vs production

I'm working on asp.net c# web application. And now I'm facing an issue with web services.
I copied the source code from production and put into my virtual machine for testing and development. However, some of the web services are not being changed while changing the URL from web.config.
I got lost trying to figure out why this happens.
Is there a place where it might be changing this web service reference to a static web service location? i.e to production always. Because currently, I'm supposed to have all the links to the testbed. Even though all of my web services inside web.config are referring to testbed, but this was keeps pointing to prod.
Please your advice.

WCF Proxy class not generating

I have a WCF service which is used by two client applications, one is a web application and the other is a Windows forms application.
When I add a service reference to the web application it works perfectly.
But, when I add a service reference to the Windows application it doesn't generate the proxy class.
Then I run selected the "Reuse types in referenced assemblies" in configure service reference section and it generates the reference with XML serialization. That is not what I needed because it gives me lot of errors since I'm using GUID everywhere.
Can anyone explain me how to generate the proxy class with runtime serialization? (both client application use same version of visual studio - Vs2010)
I'm really struggling with this and your help is highly appreciated.
You can use svcutil to generate proxy class. Add these proxy class in a DLL and then reference it in your Web and Windows application. In this way, you don't need to rely on Visual Studio and will have consistent proxy code for both Web and Windows app
More details - http://msdn.microsoft.com/en-us/library/aa702581(v=vs.110).aspx

Starting a ASP.NET restful webservice on IIS

I have developed a restful web service using ASP.NET, and while using the Visual Studio environment, it worked like a charm with IIS Express. The service itself is a complementary feature and will have to run on every machine on which our product is installed.
I have therefore created a new directory webservice, which holds the web.config and the Global.asax file, as well as a directory bin, which holds the RestulWebservice.dll file.
I then have setup a new web page on the IIS, rooting at C:\inetpub\wwwroot. The web page itself is hosting a web application, based in C:\inetpub\wwwroot\RestfulWebservice (which holds the files described above).
However, if I startup the IIS and visit http://localhost:80/RestfulWebservice, all I am getting is an error 403.14, stating that I may not inspect the contents of this folder unless I allow IIS to do so. If I choose to allow this, I am simply presented with the contents of the folder, not the service itself.
If I try to access a resource of the restful web service directly (i.e. http://localhost:80/RestfulWebservice/Home, I get a direct 404.0 error, telling me that the resource does not exist)
What am I doing wrong here, it can impossibly be this hard to get a compiled library ASP.NET web service to run on the IIS, it works like a charm on IIS express.
c:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i

Categories

Resources