问题描述
aoa我在iis上运行网站时遇到以下错误,因为它在本地主机上工作正常...
以下错误:
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
我的web.config文件是:
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>
推荐答案
<endpoint address="mex">
binding="mexHttpBinding"
contract="IMetadataExchange" /></endpoint>
错误2:
提供一个端口号,以便服务运行在那个port.change上,如下所示
Error 2 :
Give a port no so that service will run on that port.change that like below
<host>
<baseaddresses>
<add baseaddress="http://localhost:8085" />
</baseaddresses>
</host>
错误3:
不要在配置文件中使用以下代码
error 3 :
don't use below code in config file
defaultBodyStyle="Wrapped" defaultOutgoingResponseFormat="Json"
helpEnabled="true" />
在操作合同属性下使用webinvoke或webget属性,如:
use that by webinvoke or webget attribute below the operation contract attribute like:
[OperationContract]
[WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped, UriTemplate = "getData/{value}")]
错误4:
将您的配置文件保存在项目的根目录中。然后用iis配置这个包含配置文件的项目文件夹。
尝试这个建议,它可能适合你。
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 .
这篇关于关于wcf webservcie的web.config错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!