locked
WCF hosted in WAS RRS feed

  • Question

  • User755607137 posted

    Hello,

    Can anyone provide a simple WCF sample for WCF service hosted in WAS, using named pipes, especially code for hosting application, but also basic examples for the interface and the implementation classes, project template type, and where should be place custom setting in the code, not in the web.cofing. The WAS sample on the MSDN site is very very unclear, primitive and incomprehensible and mostly they suggests the usage of some tool to generate the code. I do not want to use tool to generate my code. I want to write my own code with custom configuration on order to know what exactly it doing and why something happens. Thanks!

     

    .

    Friday, December 22, 2017 6:10 PM

All replies

  • User475983607 posted

    From experience in WCF, I would get this sample working first; client and server.

    https://docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/how-to-host-a-wcf-service-in-was

    Then move bit by bit to a code version that you write yourself.  That way you know you have a working app and can point your coded client to a known working service or point a know working client to your coded service.  That will speed up your learning.

    Frankly, I've never built a named piped WCF service but I have build many client side channel factories as this gets rid of the proxy types that you end up with using the service utility.  Anyway, all the information you need can be found from the following link.  

    https://docs.microsoft.com/en-us/dotnet/framework/wcf/samples/

    This is the old WCF samples install.  It has a lot of source code and it takes a bit to get through all source and find the pieces you want or need.

     

    Friday, December 22, 2017 8:42 PM
  • User755607137 posted

    I already downloaded these samples, also the example I was mentioned in my post was exactly that describe in the first link that you suggest. There the "writers" suggest to use tool to generate the client code. I DON'T want to do exactly that. I want to write all my code (not to generate it with some tool like tn the past there was tools in VS which can be used to build DataSets, etc) and I need to know what each method or property doing. Suppose that you have to build a very reliable, very secure, working on heavy data traffic, and in the same time very simple and clear service that a MVC web app will use to perform business critical and sensitive actions. Also only a few employees from the company maybe,  would have access to the code of that service because of security reasons. Does it make sense? I think that the provided MSDN documentation is very very insufficient to understand how to build a WCF service and MS want to sell a product like Visual Studio like a black box what contain many useful tools, but no one get the key for that tools and no one know exactly what to use those tools. I already learnt the basics of the WCF, I also have experience with the earlier web services technologies but I spent two days to reproduce a some of the samples on the web and over 95% of them are useless and very basic. I need quite more customized service. Are there any better and working examples?

    Saturday, December 23, 2017 10:26 AM
  • User475983607 posted

    I already downloaded these samples, also the example I was mentioned in my post was exactly that describe in the first link that you suggest. There the "writers" suggest to use tool to generate the client code. I DON'T want to do exactly that. I want to write all my code (not to generate it with some tool like tn the past there was tools in VS which can be used to build DataSets, etc) and I need to know what each method or property doing. Suppose that you have to build a very reliable, very secure, working on heavy data traffic, and in the same time very simple and clear service that a MVC web app will use to perform business critical and sensitive actions. Also only a few employees from the company maybe,  would have access to the code of that service because of security reasons. Does it make sense? I think that the provided MSDN documentation is very very insufficient to understand how to build a WCF service and MS want to sell a product like Visual Studio like a black box what contain many useful tools, but no one get the key for that tools and no one know exactly what to use those tools. I already learnt the basics of the WCF, I also have experience with the earlier web services technologies but I spent two days to reproduce a some of the samples on the web and over 95% of them are useless and very basic. I need quite more customized service. Are there any better and working examples?

    Being very familiar with WCF and devoting countless hours learning and implementing WCF over the years, I simply described the process I would go through to get a working proof of concept all the time knowing I'm probably in uncharted territory.   My first step would be getting a known working system in place so I can use it for testing and I find the WCF samples an excellent source.  Perhaps my approach is too basic for you liking or perhaps you have already accomplished this task.   Anyway, I would start with a known working example to verify my system is setup.  From there I would build the client using the known working service.  Then build the service using the know working client. 

    I already learnt the basics of the WCF, I also have experience with the earlier web services technologies but I spent two days to reproduce a some of the samples on the web and over 95% of them are useless and very basic.

    My experience is quite the opposite as I rely heavily on the samples and find the samples have a lot of detailed information at a very granular level.  Maybe we are not talking about the same samples.

    I need quite more customized service. Are there any better and working examples?

    From your response it seems you're looking for a demo that meets exact requirements with documentation.  I'm not sure if such an example exists.  I've never been lucky in finding demo code that fits perfectly in any solution.  I usually have to tweek it a bit or combine several concepts.   Perhaps one of the Microsoft moderators can provide a solution or get you with an engineer that has sample test code.  I have some time so if you want to pay my normal fee I can build an example.

    Saturday, December 23, 2017 3:48 PM
  • User755607137 posted

    I already wrote my service and it works at least at base level using web.config configuration settings. Btw I have used the 100s examples zip files containing all examples but even there, there wasn't  well described approach how to publish the real service on IIS (i.e. should create virtual directory, etc), but didn't described that could verify just like open the *.svc file in the browser thru IIS management console in order to verify just if the one works, and so forth and so on. I'm not a witch to guess what to write as code, because 100 of thousands variations could exist, maybe some string should be in specific case (lower capital, or all lower chars, etc). Furthermore, the libraries are written on C+ and after that compiled and therefore these are nothing more than black boxes and noone know what happens inside them. If those were java script I could review them and I could solve how to use it or change them according to given case, but they are not. So, there is need of more examples with  very good description and examples for each one method, not for just for 15-20% of all methods from each assembly or namespace. 

    So, next step is to put the WCF settings in the code and this task looks like quite difficult, because of the provided examples - there are almost none or at least detailed. Each example contain some missing classes or variables. For instance - how should be used the following method: 

     public static void Configure(ServiceConfiguration config)   

    {           

          config.LoadFromConfiguration();

    }

    and why it do not load current setting from the web.config in order to be able to override them in the code behind or to validate them at least.

    Btw, there is no old technology. There is only good and bad technology. According to me, the primary goal of the WCF is to provide reliable solutions for modules used for safe and secure action like payments for instance. That is why that technology has been developed in Framework 3.0, not in 4, 4.5, 4.6, etc. Right ? I also do not use each example as exists in the net, but I change it according to the needs, but that impose the existence of detailed documentation and examples, not too limited ones and badly documented. 

    Saturday, December 23, 2017 4:57 PM
  • User1168443798 posted

    Hi Zhoro76,<o:p></o:p>

    There are many requirements in your post, it would be better to discuss one requirement in one thread.<o:p></o:p>

    >> I do not want to use tool to generate my code.<o:p></o:p>

    From my experience, the tool like svcutil.exe or VS Add Service Reference help to generate client code, and are much helpful.<o:p></o:p>

    If you do not want, you could try ChaneelFactory to call wcf service from client without generating client code.<o:p></o:p>

    # How to: Use the ChannelFactory<o:p></o:p>

    https://docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/how-to-use-the-channelfactory<o:p></o:p>

    Best Regards,<o:p></o:p>

    Edward<o:p></o:p>

    Monday, December 25, 2017 9:22 AM