C# Restful WCF HTTP错误404.0-在IIS中托管时未找到
我正在创建一个简单的WCF服务,它返回如下内容 {LoginResult:WCF A的您好} 我使用blow from浏览器访问服务 当从VisualStudio本地运行时,它在IIS Express中运行得非常好。但当部署到远程IIS时,我收到HTTP错误404.0-找不到。如果访问,我可以查看我的服务默认页面 。这是我的Web.configC# Restful WCF HTTP错误404.0-在IIS中托管时未找到,c#,.net,wcf,rest,iis,C#,.net,Wcf,Rest,Iis,我正在创建一个简单的WCF服务,它返回如下内容 {LoginResult:WCF A的您好} 我使用blow from浏览器访问服务 当从VisualStudio本地运行时,它在IIS Express中运行得非常好。但当部署到远程IIS时,我收到HTTP错误404.0-找不到。如果访问,我可以查看我的服务默认页面 。这是我的Web.config <?xml version="1.0"?> <configuration> <system.web> &
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation targetFramework="4.5">
<assemblies>
<add assembly="Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</assemblies>
</compilation>
<httpRuntime targetFramework="4.5"/>
</system.web>
<system.serviceModel>
<services>
<service name="MyService.Service1">
<host>
<baseAddresses>
<add baseAddress="http://xxx.xxx.xxx.xxx:8091/MyApp/Service" />
</baseAddresses>
</host>
<endpoint address="service" binding="webHttpBinding" contract="MyService.IService1">
<identity>
<dns value="xxx.xxx.xxx.xxx"/>
</identity>
</endpoint>
<!--endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/-->
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior>
<webHttp />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="True" httpsGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="True" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<directoryBrowse enabled="true"/>
</system.webServer>
</configuration>
问题在于address元素。应该是
<endpoint address="" binding="webHttpBinding" contract="MyService.IService1" behaviorConfiguration="webhttpbehavior">
<endpoint address="" binding="webHttpBinding" contract="MyService.IService1" behaviorConfiguration="webhttpbehavior">