1
votes

I am aware that WCF is available in .NET 3.0 and higher.

However I was wondering if it's possible to creating working WCF service Service.svc within ASP.NET 2.0 website ?

There is a reason why we have ASP.NET website in .NET 2.0, It's an old app with tons of code, built on top of 3rd party .NET 2.0 CMS system.

Now, I was able with no problem to add WCF service to the website, the following files have been created: MyWebsite/App_Code/Service1.cs MyWebsite/App_Code/IService1.cs MyWebsite/Service1.svc

Everything compiles just fine, I was able to add all required endpoints and node was created successfully.

But when I navigate to the service:

http://localhost/MyWebsite/Service1.svc

I get this error message:

Server Error in '/MyWebsite' Application. Service 'Service1' has zero application (non-infrastructure) endpoints. This might be because no configuration file was found for your application, or because no service element matching the service name could be found in the configuration file, or because no endpoints were defined in the service element.

The error message is confusing, because I have everything defined. Could it be because the website is running in IIS as .NET 2.0 app ? Or is it still possible to have WCF service inside the website that runs as .NET 2.0 app ?

Clarification The IIS virtual directory for the website is configured with ASP.NET 2.0 version. But we do have .NET 4.0 installed.

2
Is there a specific reason it needs to be apart of the same website? Why not just create a new solution for the service?George Johnston
Why not just create a virtual directory under the web site, make it an application, and make it .NET 4.0?John Saunders
George, separate project could be done no problem, true. But, yes, the website is huge and tons of functionality resides inside ascx controls (not my design :), so I was thinking to reuse that functionality instead of duplicating so much code in a separate project.monstro
John, can you do that? How do you create an asp.net 4.0 application inside .net 2.0 website? We have a really outdated environment, on DEV machine I have IIS 5, server has IIS 6.monstro

2 Answers

0
votes

Did you configure the service in the web.config? It's also possible that you're missing the right machine / global web configuration files because you didn't install .NET 3.0 or 3.5. Why not install .NET 3.5 on that machine in that case? It should be compatible with 2.0.

Do not confuse AppPool .NET version (because it's 2.0 for .NET 20, 3.0 and 3.5, it refers to the base class library version) and the used framework version of .NET.

The other solution is just the configuration of WCF in your web.config. Did you changed something in there?

0
votes

for what it's worth, see this requirements-page: http://msdn.microsoft.com/en-us/library/ms733890.aspx

if you look under 'other versions' it only goes back to 3.0... there might be other links that could help.