wcf and inserting information into the web.config - c#

Why does WCF not insert basic information about my service into the web.config? Is there a way to make it to that?
I'm talking about when you add a wcf service to project explorer

You can always use SvcConfigEditor to configure your services or clients. This has a nicer (but far from perfect) UI which can help you going quickly.

Related

How to add comments to WCF web service?

I want the clients consuming my WCF web-service to have comments on the services methods/parameters and other data contracts.
I mean, I want the XML comments which I put in the WCF server side, to appear as intellisense popups in the client application that consumes my web-service.
Which attributes can I use in the ServiceContract to achieve this?
I really want to be able to do this with out of the box solution.
I have seen a few very old "solutions", which will make this task a nightmare, and wondering if there are any 2019 build-in solution for WCF?
I'm on VS 2017, with 4.6.2 framework.
try this
https://github.com/abelsilva/swaggerwcf this provid ability to share service description

How to create a service based in a WSDL of another service

I am really new in services and are having some problems with one issue. The fact is, i have a WSDL of a SAP system and i need to create a Web API in Visual Studio based on it.
I passed some time searching for tutorial's of how to do that but don't have lucky. Someone would help me, explaining the concept or sending some tutorial where i could understand how to do that? I am completely lost and i need it for my job.
If anyone could help me i would stay quite grateful. Thank you everyone for the support.
Just host the WSDL in ur IIS i.e Create an application in IIS pointing to the directly that contains the WSDL.
And add service reference to the WSDL by pointing to the IIS Url of the application.
Then in config, change it to point to actual implementation of the service.
If you have WSDL of the service you might be able to use ServiceModel Metadata Utility Tool (Svcutil.exe) to generate your WCF client proxy with all the required contracts for it. Here is another link on generation and answer with an example, plus another example.

Consuming IIS-hosted WCF Service from Linux Web Application

I was tasked at work to create a web application (viewable in Firefox on Linux!) that displays results in a tabular format using data exposed by a WCF service (written in C#) hosted on a separate Windows 7 machine on the same network. Rather than returning formatted HTML, the WCF service returns structs and it will be up to the client application to take these objects, pull out the data, and format it.
Unfortunately, it has been a couple years since I have worked with any sort of web technologies. What is the best approach to solve this problem? Is there anything more current than REST/AJAX/JSON/jQuery technologies? If anyone can point out some helpful and current resources on the proper way to accomplish this, it would be most appreciated.
Use a SOAP framework to consume the WCF service. Configure WCF to use SOAP (one of the HTTP-bindings).
Webservices are easy to consume these days thanks to a standard RPC format (SOAP) and libraries supporting it. You can surely find a SOAP client for any language you are proficient in.
Checking back in here to report my own solution for this problem. I ended up going a bit of a different route that produced the simplest solution for the situation. Instead of consuming any services on the Linux side, I simply made an ASP.NET website on the Windows/IIS side (where it is easy to consume the WCF services right from Visual Studio), and then just render the website on the Linux side via the URL in a Firefox browser. For me, that fulfilled the customer requirements and was perfect, although this may not be the best approach for others that need to work with or manipulate the data in some way.

Basic WCF - how will the consumption of a WCF service translate to a 'real-life' deployment?

I have created a WCF service.
I am now following tutorials on how to consume this service, and the way I've been instructed to do this is to...
"..note the http address and port that Visual Studio is using to run you WCF webservice. It may look like this ([LOCAL HOST ADDRESS]). You will need this url from within the Windows Form to add a reference to the WCF service.."
http://www.thebestcsharpprogrammerintheworld.com/blogs/create-and-consume-a-wcf-windows-communication-foundation-service.aspx
Now, that's fine. But if I'm literally going to copy and paste this url into my application it will no longer be relevant to a live environment will it?
Is this really the best way to point to a WCF service in a solution?
You will see that in your app.config file the url is saved. If you deploy your service to a live server you will only need to change the config to look at the new url.
Hope I understood your question.

Accessing an SQL database from a Silverlight client (no web project)

I want to access a remote SQL database for my Silverlight client. I know that there are various ways to do this (Entity Framework model, Linq to SQL), but all of those rely on something in the web project (or, at least, all of the tutorials I've read do). What's unusual for me is that there is no web project, which of course prevents me from using various assemblies.
The only thing I do have which might be useful is a WCF service running on IIS, which will have less limitations (and I can add that as a service reference in my SL project). But I'm not even sure if this is a feasible option for this problem.
Any solutions or suggestions would be great.
Thanks.
Edit: Thanks for the suggestions guys, but here's a little more: I am making an individual XAP that is loaded into something else (someone else's project is importing and loading the XAP files), so I don't have access to the web component. The loader itself will be hosted within a website (at least, I assume it will be).
I already have a WCF service set up which is currently hosted in IIS, so I can potentially create something here. How? Well, it seems I can generate the ORM classes using SQLMetal.exe, and then import that code into the WCF service. This will allow the service to make calls to the remote database and have that data returned in C# classes. The perhaps I'll make those data classes as ServiceContracts and pass the data that way. What's the problem here? Well, to be honest, I'm not really sure how it would work. I mean, I call the WCF Service from the SL application, which does its thing. It then must contact the SL application (I have no idea how to do that part) and send along a load of data. It would be great if someone had has experience of this and would offer some suggestions. I know it's not really how you're supposed to do it, but I've drawn the short straw so I'm stuck with it.
Ok, so if I understand it correctly, you use a Silverlight application (XAP) which is started locally from a network share or something? Because why would you not have a web project when using Silverlight? (is there no server available to host it?)
But ok, when that is the case, you can access a WCF service from Silverlight. However it has some limititations. For instance you can only use asynchronous calls to the service, and you can only use WCF basichttpbinding as binding for the WCF service.
See: http://msdn.microsoft.com/en-us/library/cc197959%28v=vs.95%29.aspx
First, I would recommend you use WPF instead of Silverlight for this project. If you're not using this as a web client, then WPF is a million times easier / better.
But if that's not a possibility:
You can write a self-hosted WCF service and run it somewhere accessible. Self-hosted will allow for WCF connections to connect without the IIS necessary. In your self-hosted program you need:
Front end WCF defined
Back end SQL database
Depending on how smart this client needs to be, a BusinessLogic layer to transform the data from WCF to SQL.
Silverlight is sandboxed, so it can only access its own Web application. Therefore, your best bet is to include a WCF or ASMX web service in your web application that handles the DB access.
If you don't want to run a sandboxed UI on a Web application, you cannot use Silverlight but should use WebForms or Windows Presentation Foundation (WPF) instead.

Categories

Resources