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.
Related
I'm working on a project where I'm creating an AvaloniaUI frontend which would be able to be managed remotely via a REST API. In order to solve this, I created an Avalonia application, then added an additional project to the solution using the 'ASP.NET Core API' template.
I used the following question as a template for setup:
Hosting ASP.NET Core API in a Windows Forms Application
Here they have a similar use case, however with a winforms project rather than Avalonia.
Program.cs:
Startup.cs
When the API project starts async, the server doesn't seem to be running as it refuses the connection. The only way I have been able to get it to respond to get requests has been to set the API project as the startup project (before I had made the changes to Program.cs).
Any help at all will be appreciated, I'm relatively inexperienced when it comes to ASP.NET, so I apologise if this is a relatively simple issue.
I have found the solution.
Turns out that the server was successfully running, however due to the fact that I didn't have and SSL certificate, the server would not accept the connection except on the unsecured 5001 port.
I have recently upgraded a set of Blazor (ASP.NET Core–hosted WebAssembly) projects from .NET Core 3.1 to .NET 5.0. After having done this, I noticed I can no longer simply run the compiled executable and navigate to the localhost:xxxx address in the browser to use my application. Yet, when I run or debug my application from Visual Studio, it works fine.
I can get a similar situation by simply creating a new .NET 5.0 ASP.NET Core–hosted Blazor WebAssembly App from the template, building it, running the executable in the server project's bin folder from Windows Explorer and trying to navigate to the address (localhost:xxxx) in the browser. Curiously, the same thing seems to happen when I create it in .NET Core 3.1.
When I use the browser to navigate to localhost:xxxx, I get a 404 on the https address and get redirected to https from http even when I have unchecked Enable SSL in the reproduction solution. I also get the 404 when I use the https address to try to navigate to my application (which at the moment has SSL disabled), but I get an ERR_INVALID_HTTP_RESPONSE when I try to navigate to the http address. On the other hand, calls to a subaddress that hit the API (localhost:xxxx/api/Foo/Get) will work, though only for https.
I have trusted the self-signed certificate, so that at least isn't the problem.
What has changed or am I now doing wrong?
.NET 4.5/4.6, Visual Studio 2015, Windows Server 2016
I see here, and elsewhere, that to self host (e.g. in an exe, without using IIS) a REST service, I can do that no problem. We like this because it simplifies deployment to get IIS out of the picture.
I also have a large asp.net application.
The question: Can I move the big asp.net app into a self hosted WCF application also? (for the same reason, to move to xcopy deploy and get IIS out of the picture).
No you can not self host ASP.Net web application built using .Net framework, you can host it only using IIS server. Though if your application is built using .Net Core framework, you might be able to self host it.
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?
I have made a very simple Asp.net web site with a WCF service - "Person.svc" - that runs fine when hosted on Asp.Net development server(visual web developer 2010), but if I host on Mono's XSP 2 and access some parse error is thrown. Can WCF services live inside a XSP Web site?
You need to run a modern version of Mono. 2.6 had some initial support, but you really want to be using our trunk release as WCF there is a lot more complete.
If you have bug reports, you should report those to:
http://mono-project.com/Bugs
With a sample test case that we can use to reproduce your problem.
I have managed to run a WCF service on mono-2.6.7 on Ubuntu. Now I'm trying to migrate 2.8.2 and I'm having trouble.
(I asked Creating WCF services in mono 2.8.2 question)
Please post the "some parse error is thrown.".