首先,我尝试在web.config中添加以下代码
<system.serviceModel>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
但是我仍然没有遇到同样的错误。
然后,我尝试在web.config中也添加以下代码
<system.serviceModel>
<serviceHostingEnvironment>
<baseAddressPrefixFilters>
<add prefix="http://www.YourHostedDomainName.com"/>
</baseAddressPrefixFilters>
</serviceHostingEnvironment>
</system.serviceModel>
但仍然没有运气。现在我收到此错误:
解析器错误消息:使用注册为allowDefinition ='MachineToApplication'超出应用程序级别。
源文件上的错误:D:\ Site \ Website \ service \ web.config行:52
完整的web.config
<?xml version="1.0"?>
<configuration>
<system.serviceModel>
<services>
<service name="DESKNET.Public.TEServices.TEAPI" behaviorConfiguration="DESKNET.Public.TEServices.TEAPIBehaviour" >
<endpoint address="SOAP" binding="basicHttpBinding" bindingConfiguration="ServiceBindingSOAP" contract="DESKNET.Public.TEServices.ITEAPI" ></endpoint>
<endpoint address="REST" binding="webHttpBinding" bindingConfiguration="ServiceBindingREST" behaviorConfiguration="webHttpBehaviour" contract="DESKNET.Public.TEServices.ITEAPI" ></endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="DESKNET.Public.TEServices.TEAPIBehaviour">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="true"/>
<serviceCredentials>
<userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="DESKNET.Public.TEServices.UserAuthentication, DESKNET"/>
</serviceCredentials>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="webHttpBehaviour">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<wsHttpBinding>
<binding name="ServiceBindingSOAP">
<security mode="Message">
<transport clientCredentialType="None"/>
<message clientCredentialType="UserName" />
</security>
</binding>
</wsHttpBinding>
<basicHttpBinding>
<binding name="ServiceBindingSOAP"></binding>
</basicHttpBinding>
<webHttpBinding>
<binding name="ServiceBindingREST">
<security mode="None"></security>
<!-- </binding> -->
<!-- </binding> -->
</webHttpBinding>
</bindings>
<serviceHostingEnvironment>
<baseAddressPrefixFilters>
<add prefix="http://YourHostedDomainName.com"/>
</baseAddressPrefixFilters>
</serviceHostingEnvironment>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
关于错误,请参阅我以前的答复,WCF配置没有任何帮助。此外,您当前的WCF配置有问题。我已经对其进行了修改,请参阅下面的内容。