Reputation: 11
Hi guys would really appreciate a fix for this its driving me mad.
Using VS2010 SP1 + .Net 4.0 + IIS 7.5 Express.
A simple web project intended to host a WCF service throws a configuration exception for no apparent reason. Host is an empty web application using fileless activation.
Basically as follows :
namespace MyWCFServices
{
public class HelloWorldService: IHelloWorldService
{
public string GetMessage(string name)
{
return string.Format("Hello world from {0}!", name);
}
}
[ServiceContract]
public interface IHelloWorldService
{
[OperationContract]
string GetMessage(string name);
}
}
Web.config
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<serviceHostingEnvironment >
<serviceActivations>
<add relativeAddress="HelloWorldService.svc"
service="MyWCFServices.HelloWorldService"/>
</serviceActivations>
</serviceHostingEnvironment>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
Exception:
Server Error in '/' Application.
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Unrecognized element.
Source Error:
Line 3: <system.web>
Line 4: <compilation debug="true" targetFramework="4.0" />
Line 5: </system.web>
Line 6: <system.serviceModel>
Line 7: <serviceHostingEnvironment >
---Edit:
Same problem on the IIS forums: http://forums.iis.net/t/1180211.aspx/1
The answer is pretty poor: 'perhaps iis-express doesn't support file-less activation'.
Can anyone provide a better answer?
Cheers, Amax
Upvotes: 1
Views: 686
Reputation: 1
I had this error message:
Description: An error occurred during the processing of a configuration file required to service this request.
Parser Error Message: Unrecognized element.
The solution for me was setting up my website as an IIS application and setting the application pool to a 4.0 framework with integrated managed pipeline mode.
Upvotes: 0
Reputation: 11
Rick looks like your suspicion was correct.
I retyped the config file from scratch and problem solved.
IIS should produce a descriptive error in this case, it's misleading to just see 'unrecognized element'.
Upvotes: 0
Reputation: 11256
Strange. I jus copied your xml and pasted into my project and it worked just fine. Maybe you have a hidden character in your file???? Try cutting it and pasting into notepad, then copy it back from notepad back into a new web.config file.
Upvotes: 1