Asp.net WCF服务调用返回空文件/页

Asp.net WCF服务调用返回空文件/页,asp.net,wcf,iis,wamp,Asp.net,Wcf,Iis,Wamp,问题: 当我调用部署的WCF服务时,浏览器会下载一个空的svc文件,并且不会显示包含服务xml文件的页面 上下文: 我必须将承载WCF服务的webapp移动到新服务器。此服务在运行IIS的旧服务器上运行正常。 新服务器有2个正在运行的Web服务器。IIS 8.5和WAMP 2.5,因为服务器上有一个Php应用程序和Jira 设置: WAMP服务器侦听80端口,然后重定向到IIS,如果需要,重定向到特定端口。这是设置的一个示例 Wamp配置(https vhosts.confg): 您需要指定ME

问题: 当我调用部署的WCF服务时,浏览器会下载一个空的svc文件,并且不会显示包含服务xml文件的页面

上下文: 我必须将承载WCF服务的webapp移动到新服务器。此服务在运行IIS的旧服务器上运行正常。 新服务器有2个正在运行的Web服务器。IIS 8.5和WAMP 2.5,因为服务器上有一个Php应用程序和Jira

设置: WAMP服务器侦听80端口,然后重定向到IIS,如果需要,重定向到特定端口。这是设置的一个示例

Wamp配置(https vhosts.confg):

您需要指定MEX(元数据交换)绑定以公开WSDL。示例(查看地址“mex”):


要在浏览器中获取wsdl类型,请执行以下操作:

我不确定这个答案在将近3年后是否对OP有帮助。但它更适合于“哥达姆利安”。但是,如果希望通过HTTPS连接访问WFC服务,则需要显式指定该绑定

将其添加到Web.Config的
节点中

<bindings>
  <webHttpBinding>
    <binding name="HttpsBinding">
      <security mode="Transport">
        <transport clientCredentialType="None"/>
      </security>
    </binding>
  </webHttpBinding>
</bindings>
下面是完整的节点以供参考

  <system.serviceModel>
    <services>
      <service behaviorConfiguration="ServiceBehaviour" name="MyProject.Api">
        <endpoint bindingConfiguration="HttpsBinding" address="" behaviorConfiguration="web" binding="webHttpBinding" contract="MyProject.IApi" />
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="ServiceBehaviour">
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
          <serviceAuthorization principalPermissionMode="UseAspNetRoles" />
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="web">
          <webHttp defaultOutgoingResponseFormat="Json" defaultBodyStyle="Bare" />
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
    <bindings>
      <webHttpBinding>
        <binding name="HttpsBinding">
          <security mode="Transport">
            <transport clientCredentialType="None"/>
          </security>
        </binding>
      </webHttpBinding>
    </bindings>
  </system.serviceModel>


谢谢您的回答。我补充说,没有做任何事情。我认为这与IIS配置有关,请将旧服务器设置与新服务器设置进行比较。很抱歉,我无法及时测试此设置。我们决定使用异步控制器来解决这个问题。因为它是一个旧的Asmx服务,我们想用更新的wcf替换它,所以异步控制器似乎已经完成了这项工作。
<service name="ExampleServices.ExampleService" behaviorConfiguration="LargeServiceBehavior">
    <endpoint address="http://www.site.de/folder/service.svc" binding="basicHttpBinding"
         bindingConfiguration="someBinding" 
    contract="ExampleServiceModels.IExampleService" />
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
<bindings>
  <webHttpBinding>
    <binding name="HttpsBinding">
      <security mode="Transport">
        <transport clientCredentialType="None"/>
      </security>
    </binding>
  </webHttpBinding>
</bindings>
<endpoint bindingConfiguration="HttpsBinding"
  <system.serviceModel>
    <services>
      <service behaviorConfiguration="ServiceBehaviour" name="MyProject.Api">
        <endpoint bindingConfiguration="HttpsBinding" address="" behaviorConfiguration="web" binding="webHttpBinding" contract="MyProject.IApi" />
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="ServiceBehaviour">
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
          <serviceAuthorization principalPermissionMode="UseAspNetRoles" />
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="web">
          <webHttp defaultOutgoingResponseFormat="Json" defaultBodyStyle="Bare" />
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
    <bindings>
      <webHttpBinding>
        <binding name="HttpsBinding">
          <security mode="Transport">
            <transport clientCredentialType="None"/>
          </security>
        </binding>
      </webHttpBinding>
    </bindings>
  </system.serviceModel>