0

我有一个服务部署在 IIS 和 defaultwebsite ->Example.SampleService 节点下的服务我有一个名为 SampleService.svc 的 SVC 文件,所以当我在 IE 中浏览它时,例如http://localhost/Example.SampleService/ SampleService.svc浏览器显示它很好。我尝试通过添加与在 SOAPUI 中创建的项目具有相同地址的 wsdl 来使用 SOAP UI 对其进行测试,但是当我提交请求时,我收到如下错误:HTTP/1.1 404 Not Found Cache-Control: private Server: Microsoft -IIS/7.5 X-AspNet-Version: 4.0.30319 X-Powered-By: ASP.NET Date: Mon, 19 Oct 2015 07:54:36 GMT Content-Length: 0

web.confg 有以下内容:

 <bindings>
  <wsHttpBinding>
    <binding name="wsUserName" maxReceivedMessageSize="262144" receiveTimeout="00:10:00" sendTimeout="00:10:00" openTimeout="00:10:00" closeTimeout="00:10:00">
      <security mode="Transport">
        <!--<message clientCredentialType="UserName" negotiateServiceCredential="false" establishSecurityContext="false" />-->
        <transport clientCredentialType="None" />
      </security>
    </binding>
  </wsHttpBinding>
</bindings>
<services>
  <service name="Example.SampleService.SampleService">
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost/Example.SampleService/"  />
      </baseAddresses>
    </host>
    <endpoint address="" binding="wsHttpBinding" bindingConfiguration="wsUserName" contract="Example.IVaultService" />
    <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior>
       <!--To avoid disclosing metadata information, set the values below to false before deployment--> 
      <serviceMetadata httpGetEnabled="true" httpsGetEnabled="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="false"/>
      <serviceCredentials useIdentityConfiguration="true">


      </serviceCredentials>

    </behavior>
  </serviceBehaviors>
</behaviors>
4

1 回答 1

0

要将您的服务导入 SoapUI,您需要 WSDL 描述。要获取它,请使用以下 URI 之一: http://localhost/Example.SampleService/SampleService.svc?singleWsdlhttp://localhost/Example.SampleService/SampleService.svc?wsdl

在您必须启用元数据发布之前。

<serviceBehaviors>
  <behavior name="GlobalBehavior">
    <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
  </behavior>
</serviceBehaviors>

添加到您的服务behaviorConfiguration="GlobalBehavior"

于 2015-10-19T08:49:58.193 回答