Deploy WCF Service on IIS6 - wcf

I have an WCF RESTFull Service which i need to deploy on IIS6. I have never done this before and i am completely new to the IIS environment. I found a good solution here on the forums but its not precise enough for my case. maybe someone can give me based on this solution a more expanded version:
Option 1 - "bin" deploy (preferred option)
compile your WCF service into a DLL (class library)
create a website in IIS6
copy the WCF DLL's into the website's .\bin folder
create a *.svc file in that website
add an appropriate web.config in the website folder to define your endpoints and service configuration etc.
Your WCF service will now be reachable at the website's base address, plus the name of the *.svc file, e.g.
http://myserver/someweb/Myservice.svc
Your *.svc would look something like this:
The Service= attributes denotes the class implementing the service - fully qualified with its namespace.
What is the .\bin folder in point 3. ? Where can I find it?
I need the exact settings for the property page tabs of the website please. Also the address: http://myserver/someweb/Myservice.svc ... What is the someweb ? the physical directory of the website? or the base address from the webconfig file?
An exact step for step guide with all needed settings would be great.

For the '/bin', manually create it in the root of the website you create and copy the assemblies into it.
Create the .svc in the root of the website and access it using a similiar url to;
http://yourwebsitename/service.svc

Related

How to publish WCF service on IIS 7

I have developed and published (via the "publish" feature in VS 2013) a simple WCF web service on IIS on my local machine.
The physical deploy path is the folder : c:\inetpub\wwwroot\MyWCF_Service_On_IIS\
I saw on IIS that the virtual folder has been created under "default Web site" (with the same name : MyWCF_Service_On_IIS). The default web site listens on port 80.
Why there is no way to access the service ? whatever combination of paths and urls fails.
I tried :
localhost/MyWCF_Service_On_IIS/Service1.svc (Service1.svc is the .svc file hosting the only endpoint);
localhost/Service1.svc
127.0.0.1/MyWCF_Service_On_IIS/Service1.svc
127.0.0.1/Service1.svc
localhost
127.0.0.1
Even if I don't expose metadata endpoints I expect to see a least a help page about the service and how to get the metadata themselves.
But I only get errors
Whatever attempt I do fails miserably.
I would like to know, once and for all, what is the rule IIS uses to map virtual folders to physical folders.
We are supposed to directly deploy all related files/file directories to the root folder of the website by using FileSystem mode.
C:\inetpub\wwwroot
Moreover, we need to enable windows features to handle the SVC extension for supporting WCF service.
There is no need to use a virtual folder in that case.
Here is the content of the wwwroot folder on my side.
bin folder
PrecompiledApp.config
Service.svc
Web.config
The service URL is http://localhost/service.svc
If we specify the URL by using a virtual path. We should convert the virtual path to the application.
Then the service URL is http://localhost/MyWCF/Service1.svc.
Feel free to let me know if the problem still exists.

How to deactivate a service under an IIS host

I have more WCF services under an IIS virtual directory. I have to deactivate some of them and I thought, I have just commet out the appropriate sections in the web.config, but it seems not, the client works. Just in the browser comes the error message, that the metadata is not reachable.
Is it actually possible to somehow deactivate the services?
I had an another idea, to rename the .svc files, but I want to avoid that solution.
I am using .Net 4.0.
I've found that:
Simplified Configuration for WCF Services:
http://msdn.microsoft.com/en-us/library/ee530014%28v=vs.100%29.aspx
If you have only one service in the Web application, you may simply stop the app pool associated with the service, provided you have one app pool per web application.
If you have more than one services in the application and you just want to deactivate one,you may remove the respective svc file; or if you use config activation without any svc file, you may comment out respective line in the config. For more details about how to activate services without SVC files, you may read http://www.codeproject.com/Articles/627240/WCF-for-the-Real-World-Not-Hello-World and check the source codes attached in the article.

WCF Service Deployment in IIS Page cannot be displayed and how does the SVC file work?

Arghhh! I'm getting so frustrated trying to get my head around this WCF service.
So I created a WCF service. It works fine in my laptop where I launch it from Visual Studio 2010. Now I have to deploy it on a Windows Server 2003 machine. So I created a virtual directory on that server's IIS. Next I copied the WCF Service DLL file in the virtual directory. I also created an SVC file which had the following entry:
<%# ServiceHost Language="C#" Service="AMWCF.Service1" %>
Ok first of all, I'm so confused here. Where does this line tell the Server where the DLL file is? It just says "AMWCF.Service"! not file location!
So when I try to launch my webpage, it gives an error "THE PAGE CANNOT BE DISPLAYED". I've tried everything which I can find on the net including:
Reinstalling the ServiceModelReg
Restrarting IIS
Allowing ASP.NET in IIS
Sorry for showing my frustration here. I really really reallllly appreciate any help. Thanks guys. You guys are the best
If you have a class library with your WCF service inside, you need to copy the service DLL into the .\bin folder one level down from your virtual directory. That's where the WCF runtime looks for its service classes.
Also see these resources:
MSDN docs: How to: Host a WCF Service in IIS
endpoint.tv Screencast - Hosting WCF Services in IIS
The WCF Developer Center on MSDN has a "Beginnger's Guide" (available right from the landing page) which has tons of those excellent 5-10 minute screencasts explaining all things WCF to you - highly recommended!
Page cannot be displayed error is coming from IIS.
Add a simple html file and see if IIS can serve that file
Add a simple aspx file and see if IIS can serve that file
Now add .svc file as one of the documents in document list in IIS
Place dll in a bin folder under the virtual directory's physical path
Once you get the asp.net run time errors, it is easy find the answers
for them
If this stuff is new to you, you should use the visual studio deployment features, try right click your web project and click deploy, I think it'll solve your issues, you can even deploy using ftp through this wizard.

wcf client configuration

I have wcf client. It uses .NET 3.5.
When I compile the client I get two files:
client.exe and
client.exe.config.
The second file contains configuration for the wcf client.
In my case I need to prevent the user sitting on the computer to see the urls and change some other parameters from the config file.
So the requirements are, the end user not to see and modify the data stored in the config. The config file contains the same data as app.config. I need to forbid the person using the program to see the end point urls so easy.
Also I have a lot of configuration there so I do not like to code in the moment.
Is there any solution for the problem (embedded app.config of something else)?
Edit: I do not need configurable options. The config file is automatically created when adding service reference from the studio.
Regards
You can also create your proxies programatically instead of using the service reference feature.
Every parameter in the serviceModel config section can be represented in code as well.
The ChannelFactory class will help you create proxies to the service.
You can easily encrypt entire parts of your config files - and not just web.config in web scenarios, but also application config's in stand-alone apps.
Check out some resources on how to do this:
Encrypting web.config values
Encrypting passwords in .NET app.config file
Encrypting the app.config file for Winforms application

Hosting WCF services

I have been working on a Silverlight app that consumes a WCF service. [on Visual Studio]
as a matter of simplicity I created a WCF service in the project itself [as-in I didnt host it in IIS, but let the build-in webdev server in VS do it for me]
It works well, now I want to deploy it on IIS 7.0, can you tell me If i would need to host the service independently and then the remaining stuff or if I just publish the website, the service would be hosted too and the Silverlight client would be able to communicate with the service.
Please help!
Thanks
You basically need
a virtual directory in IIS 7
a SVC file (service file) that instructs IIS how to instantiate your service
You basically have three options to deploy your service implementation:
you can put your service implementation into the code-behind file of the SVC file - that would be my least favourable option - basically don't do it - it gets messy and offers no benefit
you can put your service class file (the MyService.cs file) and the interface file (IMyService.cs) into the App_Code directory (if you're using a Web Site project type) - again, I don't particularly like this approach
your best option: put your service contract (the interface) and your service implementation into a separate class-library assembly for that service, and deploy that MyService.dll into the .\bin directory below the virtual directory where your SVC file lives.
Then add a *.svc file (pure text file) to your virtual directory, which contains:
<%#ServiceHost language="c#" Debug="true" Service="MyService" %>
And of course, you need the appropriate web.config entries - but I'm sure you already have those, right?
Your service address now is:
http://YourServer/VirtualDirectory/YourService.svc
For more info, see How to: Host a WCF Service in IIS
Marc got you the how. In response to your question around need, you will both need and want to separate the services from the Silverlight assets (static references and XAPs). This might not make a lot of sense for smaller sites but as you grow in size this affords you the opportunity to locate your Silverlight assets on a location separate from your services (such as a content distribution network) so that they can be delivered to users as fast as possible.