I have a Web Service Project and a Web Site Project both within the same solution. I have a simple link on a web page within the Web Site Project that needs to point to a web services WSDL (example: Webservice.asmx?WSDL) within the Web Service Project. Is this possible?
Would I be better off using a hardcopy of the WSDL document and just putting that in my web site project?
I don't believe so. You will need to have the webservice run, in either IIS, or through visual studio.
Why not add a Web reference to the Webservice (Browse for "Web services in this solution") ?
That's what adding the reference does, basically... along with creation of the class mapping. Then you could always update references without having to worry about hard coded wsdl links.
Related
I've created a project of type "gRPC Service C#" in Visual Studio 2019. Can I add (and host) web pages to that project? or should I create another one (and what type of project)?
I want to use these web pages as interface with gRPC services (not call them directly from a web browser). Thank you in advance for your help.
Looks like it's possible by using a Worker but it's a lot of pain. Good practice is having a worker or IIS to host gRPC service and a web application on another project.
I'm using a RateServiceWebReference Web Reference in one solution that I downloaded from FedEx's Rate Web Service. It's a console application and I have it wired up so that everything works nicely (including the proxy class and other model class types).
What I want to do now is to copy this web reference from the console application on to my development web application.
What I've tried so far:
I tried copying whatever was in the web references folder over from the console app to the web app.
The folder icon in my solution explorer is a regular folder icon under "Web References" instead of a web reference icon.
I need to tell it that the folder is actually a web reference.
I tried adding a web reference and I put in the TEST endpoint (https://wsbeta.fedex.com:443/web-services/rate) and it gives me an error 405 method not allowed.
I'm open to alternatives.
I found out how to do it. Instead of copying the Web Reference itself, I took the WSDL, created a test website that pointed to it, and added the web reference to the new solution. It works like a charm.
Thanks to Stack Overflow and a few other sites, I understand the difference between the WCF LIbrary and WCF Service Application templates.
Briefly the Library is a DLL that allows for multiple types of hosting. It does not have a .svc file. While the Service Applications template is created specifically with IIS in mine with a .svc file.
I read that WCF Service Library is the best way because it is the most flexible. But I NEVER see instructions on how to do it apart from using the WCF Service Application template.
Is it difficult to go from WCF Service Library to hosting on IIS from scratch? I have two books on WCF and I've read numerous articles and none of them cover how to create a svc file using only the WCF Service Library and No WCF Service Application. Why?
Nigel Shaw also mentions on the following link that there are limitations to using the Library option. What is the purpose of WCF Service Library?
Basically What I want to do is host the WCF Service on both IIS and a Windows Service. Thus it appears that the combined way is the best way. Nevertheless, I'm trying to learn why there aren't more instructions on using the WCF Service Library.
Ok, I did find a couple of articles that seem to use an ASP.NET Web Application and tells you how to create a text file for the svc file.
This article: http://debugmode.net/2010/12/25/wcf-service-library-creating-hosting-and-consuming-wcf-service-with-wcf-service-library-project-template/
and this one: http://danielvanwyk.wordpress.com/2010/04/30/create-host-and-consume-a-wcf-service-using-the-wcf-service-library-template-in-visual-studio-2008/
But what I still don't understand is why is the ASP.NET Application still needed? And If i add a svc file does it get placed in the wwwroot directory (that seems to be where the WCF Service Application places it .svc file?
Thanks!
A WCF Service Library has to be hosted in order to be used - you can host it in IIS, a Windows Service or some self-hosted option (like a console app, WinForm, WPF, etc).
In the last two links you provide, they're demonstrating how to host the library in an ASP.NET service application, but you don't have to use that project template to host it. It's simply one option out of several.
You can create an IIS-hosted implementation of your class library without using a VS project template, but you'll need to manually add the .svc file and the Web.config. I have done this several times:
Create a folder (I normally put mine in the wwwroot folder of inetpub, but you can put it wherever you desire).
Create a bin folder in the folder you created in step 1, and put the WCF service library and any other required assemblies in it.
Add a .svc file with the appropriate markup in the folder created in step 1.
Add a Web.config with the appropriate service model configuration in the folder created in step 1.
Create an application in IIS that points to the folder you created.
Now you have an IIS-hosted instance of your service. You can then use another copy of the WCF service library for your Windows-Service hosted instance.
Im new to .net and I have my website solution and I added my database WCF service to the solution, how can i reference the service's interfaces? I will be making changes to the service as i develop, do I have to build/Deploy the service every time or can i just reference the .svc file somehow?
[nkvu - moving out of the comments & as an answer in case it needs to be found later...]
If your WCF service is a separate project in the same solution as your web project then you should be able to follow the instructions here under the "To add a reference to a service in the current solution" heading...After you make changes you can just use the instructions under "Update a Service Reference" to make sure your web project is in sync with the service changes
I need to consume an existing web service in ASP.net.
The documentation of the website that provides the web servicesays that I have to use WSDL.exe to generate a stub, but I can't find this tool.
I also tried the Add web reference wizard in Visual Studio 2010 (VS2010), but if I paste the URL in, VS2010 doesn't work anymore.
What am I missing?
As far as I remember there should be a choice between .net 2.0 and WCF services.
Try to select .net 2.0 web service type. We had to do it for using SOAP web services running on Python.
You might also try using the Add Service Reference Wizard instead - worked for me for WebServices the Web Reference Wizard did not like quite as much. Make sure to use the link to either the asmx (if it's one) or the .wsdl
As far as I know, you can't create SOAP webservice with .net 4. When you creating new project, you need to choos .net 3.5 or earlier first, and then create project.
As for creating stub from existing wsdl, I don't know how to do it.