0
votes

I have a Silverlight application that communicates to a WCF service. As part of the web.config file there is a required section to use WCF:

<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" 
multipleSiteBindingsEnabled="true" />
</system.serviceModel>

Upon deployment to a Windows 2008 server I get the following error when launching my Silverlight app:

Parser Error Message: It is an error to use a section registered as
allowDefinition='MachineToApplication' beyond application level.  This error can be
caused by a virtual directory not being configured as an application in IIS.

Source Error:

Line 29: 
Line 30: <system.serviceModel>
Line 31:         <serviceHostingEnvironment aspNetCompatibilityEnabled="true"
Line 32:             multipleSiteBindingsEnabled="true" />
Line 33:     </system.serviceModel>

After some research there are a couple of items that could cause this:

  1. The directory where the app resides is not setup as an application in IIS
  2. Multiple web.config files exist in one or more sub-directories underneath the application structure.

Neither of these situations apply in my case. My app is setup as an application under IIS and there is only one web.config file in the application structure.

Any other reasons this message would occur? It also happens if I explicitly define the authentication type in the web.config file for the app.

Thanks for your help.

1
I figured out the issue. Turns out there were multiple websites setup under IIS with the same bindings. One of the sites in question was active when it should not have been. It picked up my request and accessed the app as though it were a regular directory since it did not have it setup as an application. - Jeff Cope

1 Answers

0
votes

In addition, for me to make it work, I had

... CodeBehind="mypage.aspx.vb" inherits="Account5.mypage"

and I changed it to

... CodeFile="mypage.aspx.vb" inherits="mypage"

I hope this helps someone else.