WebService Within a Web Application - vb.net

I have this project developed by some goofball who decided to nest a dependent WebService within the Web Application that uses it. This has caused problems with publishing changes because you can't update the WebService without Publishing your changes first, and you can't Publish the changes without the WebService being updated at the publishing location. It's totally paradoxical.
Any suggestions on how to remedy this simply? I'm thinking it might be best to somehow extract the WebService out into a separate project which can be published independently (this is best practice after all, isn't it?). Also note that I have updated the project to .NET 4 which has the option to use a WCF Service instead, however if this would require a major reworking of the project, then I would like to keep things as simple as possible.
It's difficult to provide any code to illustrate this problem, but here is the basic hierarchy of the project.
Solution
Project
WebService
MyService 'This is a reference to the Web Service
Service
MyService.asmx 'This is the actual code for the Web Service
[Other Code Pages within the project]
EDIT: What if I did this? This way they could be compiled and published independently of each other.
Solution
Project - App
Web Reference
MyService 'This is a reference to the Web Service
[Other Code Pages within the project]
Project - Service
Service
MyService.asmx 'This is the actual code for the Web Service
The only remaining decision (assuming this is a recommended approach) would be whether to create a WCF Service Library or WCF Service Application? (Remember, this service is only used by this one app and is not shared by any other).

I would definitely extract the web service into a new project.
In addition, if there is other "shared" code (classes, modules) that is common between the projects, you have a couple of choices, depending on how much code needs to be shared:
1) Link the source files from one project or the other (so that you only have a single physical copy of the class)
2) Create a DLL project that each of the projects references and then move the shared code to that project.
3) (Obviously) Duplicate the code in each project.

Related

How to add WCF Service to .NET Core project in Visual Studio 2019?

I am unable to add a connected service reference to a WCF endpoint in VS 2019. I used to be able to do it in VS2017 with an extension. Now I can't find the extension anywhere, and when I try to add a connected service, I get lots of options but nothing for a WCF service.
Just to clarify, I am not trying to develop a WCF service, just trying to create a service reference to act as a client to a remote WCF service.
There is an article on how to use such a tool, here, but absolutely no information on where to find the tool or how to install it. I even found what may be the source code for the tool, but again with no installation instructions.
My project is a .NET Core project, targeting NetStandard 1.6.
.Net Core is still supporting client-side. You can use hosted service in it and add the ip:port/wcfinterface from the connected services.
You can try it by following this link.
I was able to resolve this issue by simply creating a new class library targeting NetStandard2.0. Right-clicking on Dependencies -> Managed Connected Services now showed an additional item below the Service Dependencies item, called Service References. Adding a new Service Reference, you are then presented with a WCF option.
I tried re-targeting this class lib back to NetStandard1.6, and all is still working. My original class lib was very old, and had some old stuff like dnxcore50 in the .csproj file, so maybe something there was screwing it up.
Thanks all for the suggestions.

Multiple apps in umbraco with IApplicationEventHandler

I recently started refactoring my site resulting in the following situation. I have a separate project containing all the surface controllers, views etc for the frontend users. In this project there is also StartupEventHandler wich registers the interfaces, controllers etc using AutoFac. I started a second project file containing the controllers, etc for the backend users. This project also uses AutoFac in the startupeventhandler and registers practically the same iterfaces as both front end en backend share the same services amongst them.
Now when I start the site, the frontend looks good. But when going via the umbraco backend the views dont get rendered with an error "Parameterless constructors not found". When I rebuild and restart, the backend page gets rendered without errors, but now the frontend pages give me the same error. Until I restart the site.
My guess I has to do with AutoFac and two startup handlers. The handlers each reside in their own assembly and namespace ...web.client and ...web.admin.
Anyone any clue on how to resolve this. I dont think it has to do with Umbraco as there are plenty of plugins which probably have also their own startup handlers.
I think I have found a proper solution. As I told in my question I had a separate project productname.customername.web.client and productname.customername.web.admin. What I have done is taking all the start up event logic out of those projects, created a new project productname.customername.web and put in there. From there I added a reference to both client and admin project and registered the controllers. It works fine now.

creating web service in VB.NET

I have just little background in web and I need to do this task by myself so I will be most grateful for your help
this is what my boss told me to do (as far as I understand) - I have to write a web service server which gets some parameters, check their validity and then insert/update them in a database. All the parameters are delivered together as a packet written in SOAP - WSDL file. I have to do it using vb.NET in Visual Studio 2010. I read a bit about it and if I understand correctly .NET takes care already of the SOAP an WSDL issue, it is transparent to me, isn't it? or should I install or implement anything concerning that? I saw some examples in the net that all you have to do is to implement web_method in the asmx file, is it so? if yes, which parameters will my method get - the whole bunch of 20 parametres supposed to be in the packet? anything I need to declare or to update in order to connect to the DB? Any help will be appreciated - uf the answer is too long I will be happy just to get a pointer to some relevant material I can read and learn.
Thanks a lot
Try reading this MSDN article: it describes how to write a simple Web service by using Visual Basic .NET
Here are the main steps from the linked MSDN article:
Start Visual Studio .NET or Visual Studio.
Create a new Active Server Pages (ASP) .NET Web service project. Name the Web service MathService and point the location to an
appropriate Web server that is running ASP.NET if necessary.
Change the name of the Solution file to MathService for consistency.
Change the name of the default Web service that is created from Service1.asmx to MathService.asmx.
Click Click here to switch to code view in the designer environment to switch to code view.
Change the name of the class from Public Class Service1 to Public
Class MathService.
Define methods that encapsulate the functionality of your service. Each method that will be exposed from the service must be flagged with
a WebMethod attribute in front of it. Without this attribute, the
method will not be exposed from the service.
Click Build on the Build menu to build the Web service.
Browse to the MathService.asmx Web service page to test the Web service. If you set the local computer to host the page, the URL is
http://localhost/MathService/MathService.asmx.

Help with silverlight

I have some methods which are not compiled with Silverlight framework but are very essential for execution of SL workflow(by workflow, I mean to process my application completely). What is the best/quickest way to do so?
I was thinking of publishing a web-service(for non-sl compiled methods) and make SL call into my WS.. but I am unable to see/create webservice instance even after registering one in my SL project. (I am using VS 2010)
any help?
Esentially, you have three ways to run code.
native built-in methods in your application--this would be the easiest way
methods that live in an external silverlight assembly, like a class library
use a webservice
if you use a webservice, you have to either host the website yourself or use a 3rd party website, then add a reference to said service. if the service is not hosted on the same website as your silverlight app, there must be a cross-domain policy file in place otherwise silverlight will not use the service.
if you use an external assembly, it MUST be a silverlight assembly. you can not use a windows class library, etc.
There is a common (and relatively easy) way to solve this issue without requiring a web service: you can create a new Silverlight class library and then share the files from the other project through to your new Silverlight library.
To do this, right click on the library in the Solution Explorer, and select Add -> Existing Item, then navigate to the appropriate code file, select it, but instead of just clicking Add you should instead click the little down arrow and select Add As Link.
Of course when you do this you have to ensure that the shared files don't contain anything that cannot be compiled targeting the Silverlight runtime, if they do then you will either have to use conditional compilation directives to isolate out that code, or revert to the web service option.

Monotouch Web Reference Namespace Issue

I have an ASP.net web service sitting on a server, and I have verified that it works properly via a small test client app in VS.
I went to add it in MonoDevelop to my MT application, (Trying both the ASP.net 2.0 and WCF declarations). Inside the "Add Web Reference" wizard, it finds the web service fine. But when I go to reference it, the app doesn't know it exists.
I went to look at it, and it seems when adding it, the namespace it's assigning to it is the title of my solution (which has spaces in it), but the namespace for each of my .cs files within my app contains no spaces.
Web Service Namespace (that it wont let me change): Ultimate GameDay 2011
MT Application Namespace: UltimateGameday2011.
So I manually went into the reference.cs file and took out the spaces. The app classes then saw my web reference object, but it still won't allow me to access any of its members.
Any help would be greatly appreciated.
Check out the following link http://merbla.blogspot.com/2011/03/monotouch-with-json-using-aspnet-mvc.html
Its not a fix to your problem rather a method of creating web services that MonoTouch more easily works with. In my experience ASMX and WCF services have been problematic when consuming in a Monotouch app.
If all else fails, try using the Silverlight service utility located in your programs folder
e.g. C:\Program Files (x86)\Microsoft SDKs\Silverlight\v4.0\Tools\SlSvcUtil.exe