which files need wcf web service deployment on iis - wcf

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.

Related

Default route in MVC working from VS, but not on test server

I have a very simple ASP.NET MVC 4.0 website. It's got a single controller ("HomeController") with a single action ("Index") which receives a single parameter ("string id"). I have not modified the global.asax file since this kind of route is handled by default. I have not created a view for this action since the action will simply be "sending" the user a file (a PDF). If I run the site from within Visual Studio (using a default page of "home/index/3" in project properties), the page runs fine. If, however, I publish the site to our test server (https://ourserver.com/mysite/home/index/3), I get a 404--File or Directory not found.
NOTE: We're running IIS7.5 on this server.
UPDATE: The bin dir (and the appropriate DLL, i.e., one named after the project) and the web.config file are there.
So, why is this not working?
If you're using an older version of IIS and haven't installed the MVC server extensions which give you routing, you can do a BIN deployment of the necessary infrastructure files.
Edit: If you're running IIS 7.5 you should have everything you need. You mention you don't see a web.config file or any dlls - how did you publish? You should absolutely have a web.config at the root of the publish directory and a bin folder with your dll(s).
If you right-click on your web project and do Publish, you can publish to a local directory. It'll be exactly what you should see when deployed.
Edit 2: Did you check that it's configured in IIS as a web application and not just a site?

WCF Test client only loading services in same project

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.

Making TFS include the Published WCF Services in release build

We have a release build where we want all the WebApps and WCF Services included as separate zipfiles in the build.
The release build includes all our solutions in "Items to build" on the Process page of the build.
We use the following "MSBuild Arguments" on the Process page:
"/p:CreatePackageOnPublish=True /p:DeployOnBuild=True"
This works great for the Web Application projects, these are zipped and included, so we can unzip them from a Powershell script and deploy them on a server.
However the "WCF Services Library"-projects and "WCF Service Application"-projects are not included.
I've also tried setting the
<DeployOnBuild>True</DeployOnBuild>
<CreatePackageOnPublish>True</CreatePackageOnPublish>
in the csproj file, but it did not get included (as explained in http://vishaljoshi.blogspot.com/2010/11/team-build-web-deployment-web-deploy-vs.html)
Does anybody know how to make MSBuild also include the "WCF Services Library"-projects?
We use TFS 2011, but it should be compliant with TFS 2010
One way of doing this would be to have an Asp.net website which acts as host to the WCF service library in the same solution which just references the WCF service library and has its .svc file.
So now when you trigger a TFS build you will be able to have the Asp.net website in the "_PublishedWebsites" folder which essentially means you have managed to publish the WCF Service using TFS.

Location of app.config file in a windows service project?

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.

deploying wcf service application as a precompiled app

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.