Click here to Skip to main content
15,879,535 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
aoa i am getting following error while running website on iis, as it is working fine in local host...
following error:
Server Error in '/FINANCE' 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: 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 55:       </endpointBehaviors>
Line 56:     </behaviors>
Line 57:     <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
Line 58:   </system.serviceModel>
Line 59:  <system.webServer>


Source File: D:\usb\saba final pjct\test\test\test\web.config    Line: 57


my web.config file is:


<configuration>
  <connectionstrings>
    
    <add name="bcountsdb" connectionstring="Data Source=123-PC;Initial Catalog=bcounts;Integrated Security=True" providername="System.Data.SqlClient" />
  </connectionstrings>
  <system.web>
    <compilation debug="true" targetframework="4.0" />
  </system.web>
  <system.servicemodel>
    <bindings>
      <wshttpbinding>
        <binding name="CustomAuthentication">
          <security mode="Message">
            <message clientcredentialtype="UserName" />
          </security>
        </binding>
      </wshttpbinding>
    </bindings>
    <services>
      <service name="test.ipadservice" behaviorconfiguration="servicebehavior">
        <endpoint address="" binding="webHttpBinding" contract="test.Iipadservice" behaviorconfiguration="web">
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding">
       contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseaddress="http://localhost/" />
          </baseAddresses>
        </host>
      </endpoint></service>
    </services>
    <behaviors>
      <servicebehaviors>
        <behavior name="servicebehavior">
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <servicemetadata httpgetenabled="true" />
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <servicedebug includeexceptiondetailinfaults="true" />
          <servicecredentials>
            <!--   <servicecertificate findvalue="MyWebSite">
                     storeLocation="LocalMachine"
                     storeName="My"
                     x509FindType="FindBySubjectName" />-->
            <usernameauthentication usernamepasswordvalidationmode="Custom" customusernamepasswordvalidatortype="test.usernamepassvalidator,test" />
          </servicecertificate></servicecredentials>
        </behavior>
      </servicebehaviors>
      <endpointbehaviors>
        <behavior name="web">
          <webhttp automaticformatselectionenabled="false">
         defaultBodyStyle="Wrapped" defaultOutgoingResponseFormat="Json"
         helpEnabled="true" />
        </webhttp></behavior>
      </endpointbehaviors>
    </behaviors>
    <servicehostingenvironment multiplesitebindingsenabled="true" />
  </system.servicemodel>
 <system.webserver>
    <modules runallmanagedmodulesforallrequests="true" />
  </system.webserver>
  
</configuration>
Posted
Updated 5-Jun-14 4:57am
v3
Comments
j snooze 5-Jun-14 16:45pm    
The error sounds to me like you don't have the site or app defined as an application in IIS. It should be defined as that with a .NET app pool targeted for 4.0.

1 solution

Error 1 :
change the 2nd end point address as below

XML
<endpoint address="mex">
                binding="mexHttpBinding"
               contract="IMetadataExchange" /></endpoint>


Error 2 :
Give a port no so that service will run on that port.change that like below
XML
<host>
          <baseaddresses>
            <add baseaddress="http://localhost:8085" />
          </baseaddresses>
        </host>


error 3 :
don't use below code in config file
XML
defaultBodyStyle="Wrapped" defaultOutgoingResponseFormat="Json"
        helpEnabled="true" />

use that by webinvoke or webget attribute below the operation contract attribute like:
C#
[OperationContract]
        [WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped, UriTemplate = "getData/{value}")]

error 4:
keep your config file on root directory of project . then while configuring this with iis point the project folder which contains config file .

try this suggestions ,it may work for you .
 
Share this answer
 
Comments
Member 10690757 6-Jun-14 7:55am    
thanks :) can you tell me that how can i set my website bindings... i want to get this data on ios ...
Pravuprasad 7-Jun-14 1:58am    
In this case only Webhttp binding will work. And define that binding under <binding>in web.config

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900