WCF service from class library "view in browser" command with https - wcf

I have a Class library with WCF service added. When I click on command View in Browser it opens with http prefix. Is there a way how to open it with https prefix without hosting it on iis ? Thanks

If you are using 'Cassini' or the web server built into VS, then SSL is not supported. But if you change your web settings (by choosing Properties from your project), you can host in IIS. IISExpress might support it, but again requires a change to the project settings.

Related

Octopus Deploy: Enable SNI on IIS HTTPS binding?

We're using Octopus Deploy and its "IIS web site and application pool" process feature to deploy our ASP.NET MVC app to IIS. It's working great.
Now, we would like to enable SNI for the HTTPS binding. Octopus Deploy doesn't seem to provide a built-in checkbox for this. How could we customize the Octopus Deploy's IIS deployment so that the SNI is enabled automatically?
If it makes things easier, it's OK for us if Octopus Deploy automatically enables SNI for all the HTTPS bindings, we don't need a setting for it.
For anyone still looking for a solution on this, at this time of writing, octopus now offers this exact feature on the "deploy an IIS Website step template, right on the bingings section, you can create https 443 bindings where you can specify a cert and check the "require sni" option, to automatically deploy certs per each virtual host.
This isn't currently possible to do with the built-in IIS configuration feature; instead, you could use a custom PowerShell script (PostDeploy.ps1 in your package, for example) to make the appropriate changes. I've logged a work item here to add it when we next revisit IIS configuration:
https://github.com/OctopusDeploy/Issues/issues/430

Installing and using cutom certificate for Wcf service hosted in windows to enable SSL(HTTPS)

I have WCf service hosted in windows service.
I would want to know how would i make service accessible only through SSL and use certificate provided by certificate issuer(Godaddy,verisign etc).
If you created a WCF-Service you'll be forced to use an Windows IIS Server to host your application. When using an IIS, you can specify the Port and an SSL-Certificate.
To do this, just
add a new Website to your IIS. Make sure, you are using an application pool that supports .NET Framework 4.0.
copy your compiled WCF-Service and all references/files that your services needs to the associated IIS-Site-Folder
Configure the Bindings of this IIS Page. You need an imported SSL-Certificate at this point. If you already imported it, you can choose it from a ListBox within the Bindings-Dialog.
Within that dialog, you can specify the port
Make sure you've opened that port on your firewall
If you delete other bindings (meaning all HTTP Bindings), you can make sure that your service is only reachable through SSL and your specific port.
If you need cheap, good and multidomain/wildcard certificates, please check out StartSSL. In my opinion, they serve you the best.
You can find more information about IIS Configuration here.

Hosting a WCF Service Application on IIS 7 where I already have a WebSite

Can somebody help me.
I just developed a WCF Service Application on my pc, and everything works fine when I run it on localhost!
But now I want to host this project on my IIS7 where I already have a website. I would Like to host my WCF in this website, because I would like to use the same hostname and IP Address, is this possible ?? I dont know if I can Add a Application in the website or something like that.
If this is possible how can I do this???
Please Help me.
Yes, you can host your application in your IIS website, even if it has a website installed on it. You need to create a new application in that website.
First of all, you need to make sure your service has a .svc file that points to the location of the service, copy the contents of your App.Config (Service config file) to a new web.config (in the same physical directory as your App.config) and also remove the <host><baseAddresses> section in the newly created web.config, point the physical path of the application to the location of this service on your computer. Once that's taken care of, just be sure to edit the default website bindings to enable the specific bindings your service uses, for example if your service has netTcpBinding then go to: Website -> 'Edit Bindings...' -> 'Add...' then choose the applicable protocol and assign it the ports. Then on your application go to 'Advanced Settings' and enable the respective protocol, for example your netTcpBinding service will typically have http,net.tcp as it's enabled protocols. and you're set. If you run into teething errors make sure the default app pool (or which ever application pool your website is using) has the required permissions to access and read the physical directory on your computer in which the service resides.

How do I configure Visual Studio to see a net.tcp URL on local IIS?

I've got a WCF service using the netTcpBinding, and no other binding. It works great when I manually deploy the files to IIS, and my client application can consume the service when I enter the net.tcp://localhost(etc) url. Now I'm trying to get the project to run in Visual Studio, so I can have the service and client in the same solution, and reference the service directly instead of going through IIS, and having to redeploy files manually.
Neither IIS Express nor the Visual Studio Development Server can use net.tcp, so they're out. In the Web tab of my service project, the "Use Local IIS Web Server" or "Use Custom Web Server" looked like good options, but neither of them will accept a URL that doesn't begin with http.
Is there some way of making my WCF service use IIS, and having my client reference the service directly (so that I don't have to deploy files to IIS, and then update service reference, every time I compile)?
Start the service in WcfSvcHost, then try to add a reference to the hosted URL.
Unfortunately, the VS IDE has no technique to start services automatically, except for when you're debugging.
Also, you always need to update service references explicitly. You need to decide which of your changes are ready to be applied to which clients of your service. It would be bad to assume that all clients should be updated as soon as you make a change then compile your service.
You could add a project, which you don't deploy, but only use during development, that self-hosts the service.

No intropage in a Managed Windows Service

I have to do some maintenance on a WCF service that is hosted in a managed windows service.
In the old deployed version I can enter: http://localhost:9091. It shows a page with info about the hosted WCF service (with a C# and VB example).
When I get the sources from TFS and reinstall with the MSI, the same http://localhost:9091 gives a 404.
What could be wrong ?
Could be lots of things. Try these for a start:
Installed msi on wrong port
web site / app pool not runnig
the configuration in web.config does not match the new location
Web site not marked as asp.net 2.0
IIS not configured to recognise svc files
The last 3 are the most probable. Check the event log for more details.
Here are a few more based on the comment:
is the service started
is the port blocked on the new machine
the configuration in web.config does not match the new location
Perhaps that port is meant to be the port of the ASP.NET Development Server. Is the service started? Open the solution in Visual Studio, right-click the service and choose "View in browser". That will have the side-effect of starting the service.