我刚刚为WCF服务生成了安装程序,我正在尝试使用: wwwroot上安装的结构如下: http://bit.ly/11zZ85E
在bin文件夹中包含服务所依赖的所有dll。实现服务契约的类在其中一个dll中定义。所有发电和安装过程都很好。我在IIS管理器上有以下内容:
问题在于,当我尝试在浏览器中访问wsdl时,我只能看到:
<%@ ServiceHost Language="VB" Debug="true" Service="MyApplication.ServiceImplementation.LicensingService" CodeBehind="MyApplication.ServiceImplementation.Service.vb" %>
如果我尝试使用Visual Studio项目中的“添加服务引用”,我会看到:
下载时出错 (ServiceAddress)/ $元数据 请求失败,HTTP状态为404:未找到。 元数据包含无法解析的引用: (ServiceAddress) 远程服务器返回意外响应:(405)方法不允许。 远程服务器返回错误:(405)方法不允许。 如果在当前解决方案中定义了服务,请尝试构建解决方案并再次添加服务引用。
我所做的安装程序是使用Installshield 2010生成的。
这是我的Web.Config
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation strict="false" explicit="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
<system.serviceModel>
<services>
<service name="MyApp.ServiceImplementation.Service" behaviorConfiguration="WSSecurityBehavior">
<!-- Service Endpoints -->
<!-- Unless fully qualified, address is relative to base address supplied above -->
<endpoint address="Operations" binding="wsHttpBinding" contract="MyApp.ServiceContracts.IService" />
<endpoint binding="wsHttpBinding" name="mex" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="WSSecurityBehavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<wsHttpBinding>
<binding name="WSSecurityBinding">
<reliableSession enabled="true" ordered="true" />
</binding>
</wsHttpBinding>
</bindings>
<!--protocolMapping>
<add binding="basicHttpsBinding" scheme="https"/>
</protocolMapping-->
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<directoryBrowse enabled="true" />
<handlers accessPolicy="Read, Script" />
<defaultDocument>
<files>
<clear />
<add value="Service.svc" />
</files>
</defaultDocument>
<httpErrors>
<clear />
</httpErrors>
</system.webServer>
</configuration>