I restructured a WCF project to separate the service.cs and contracts to separate projects. In the main WCF project I place only a service.svc file that references (dll, not service reference) the service class. I also updated app.config to reflect the change.
Once I do this, the wcf test client no longer loads the service. It gives no errors. I can publish to my local IIS and it still works just fine.
Do I need to add something to the wcftestclient.exe command line options?
Is the dll of the project that has the contracts in there also? Make sure to copy everything from the bin/debug (or bin/release) into IIS virtual directory.
Related
What files do i need to put in iis directory when deploying wcf web service in iis adding as site?
For example:
Is it just dll from bin and service contract?
Does example.cs code files need to be copied in iis directory too?
It depends what you have in your service.
Usually, the bin folder, the configuration file and .svc file, if it exists.
But it's better let Visual Studio handle this. Right click over your service project and then "Publish". Visual Studio will copy everything you need to deploy to a folder.
I want to update my WCF services, by adding a couple of new methods at the service description. I've build the new dll's with the new methods, copied them in the bin folder of the WCF website hosted on IIS of the remote server and tried to generate the new proxies with svcutil.
Svcutil however doesn't generate the .xsd files. The mex endpoint is set, httpGetEnabled is set to true. Could any change in IIS settings cause this? Because thats the only thing that might have changed since I last updated the services successfully, about a month ago.
I am creating a windows service in VS2010, and in order to store a user's input during installation I've been told to write it to a file called app.config.
However i cannot find this app.config file? Does it create one in a windows service project? or just in a WCF windows service project?
In VS do the following:
Click on the service project
And add new item
Select Application Configuration File.
This will appear in your service project as app.config.
When you actually build the project you'll see it a Spotter.exe.config along side your Spotter.exe file.
I have a wcf service application that has some application startup code in the app_code folder of the project. When i publish this project to my website, it deploys it with source code and app_code folder.
Is there a way to precompile the wcf app ( like an asp.net app), that includes all the dependencies and compiled code ?
i checked the web deployment package files, and even that has the source code of app_code folder.
problem here really is that since the template for wcf does not expect app_code folder and .cs files in it, they get added as content, changing them to compile would include them in the web dll
Your best bet would be to:
put all your WCF service-related code into a separate class library assembly
deploy that assembly to the .\bin directory
only put your MyService.svc file (without any code-behind) to your virtual directory
With this setup, the WCF service is still being hosted by IIS, but you don't need to do any special tricks and hacks to get it to work properly.
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.