Configuring the web.Config system.serviceModel

0

Good evening,

How can I configure the "system.serviceModel" in the Web.Config, I'm getting the following error from the application:

  

The default endpoint element that references the 'VirusWS.scanFile' contract was not found in the client configuration section of ServiceModel. The reason may be that no configuration file was found for the application or no endpoint corresponding to this contract was found in the client element.

And searching the Internet tells me to manually add the endpoint, but I do not know how to do it. This is the .WSDL:

<?xml version="1.0" encoding="UTF-8"?>
<definitions name="scanFile"
    targetNamespace="http://algo.com/algo"
    xmlns="http://schemas.xmlsoap.org/wsdl/"
    xmlns:tns="http://algo.com/algo"
    xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema">

  <message name="scanRequest">
    <part name="file" type="xsd:base64Binary"/>
  </message>
  <message name="scanResponse">
    <part name="success" type="xsd:string"/>
  </message>

  <portType name="scanFile">
    <operation name="scan">
      <input message="tns:scanRequest" name="scanRequest"/>
      <output message="tns:scanResponse" name="scanResponse"/>
    </operation>
  </portType>

  <binding name="scanFileBinding" type="tns:scanFile">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
      <operation name="scan">
      <soap:operation soapAction="" style="document"/>
      <input name="scanRequest">
        <mime:multipartRelated>
          <mime:part name="bodyPart">
            <soap:body use="literal"/>
          </mime:part>
          <mime:part name="fileToScan">
            <mime:content part="file"/>
          </mime:part>
        </mime:multipartRelated>
      </input>
      <output name="scanResponse">
        <soap:body use="literal"/>
      </output>
    </operation>
  </binding>

  <service name="scanFileService">
    <port binding="tns:scanFileBinding" name="scanFilePort">
      <soap:address location="https://111.11.111.11:111"/>
    </port>
  </service>
</definitions>

I add my web.config

<?xml version="1.0" encoding="utf-8"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <connectionStrings>
    <add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;AttachDbFilename=&quot;|DataDirectory|\aspnet-Servicio Virus Scan-20170921114749.mdf&quot;;Initial Catalog=&quot;aspnet-Servicio Virus Scan-20170921114749&quot;;Integrated Security=True"
      providerName="System.Data.SqlClient" />
  </connectionStrings>
  <system.web>
    <authentication mode="None" />
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" />
    <pages>
      <namespaces>
        <add namespace="System.Web.Optimization" />
        <add namespace="Microsoft.AspNet.Identity" />
      </namespaces>
      <controls>
        <add assembly="Microsoft.AspNet.Web.Optimization.WebForms" namespace="Microsoft.AspNet.Web.Optimization.WebForms" tagPrefix="webopt" />
      </controls>
    </pages>
    <membership>
      <providers>
        <!--
	      ASP.NET Membership is disabled in this template. Please visit the following link http://go.microsoft.com/fwlink/?LinkId=301889 to learn about the ASP.NET Membership support in this template
        -->
        <clear />
      </providers>
    </membership>
    <profile>
      <providers>
        <!--
	      ASP.NET Membership Profile is disabled in this template. Please visit the following link http://go.microsoft.com/fwlink/?LinkId=301889 to learn about the ASP.NET Membership support in this template
        -->
        <clear />
      </providers>
    </profile>
    <roleManager>
      <!--
	        ASP.NET Membership Role is disabled in this template. Please visit the following link http://go.microsoft.com/fwlink/?LinkId=301889 to learn about the ASP.NET Membership support in this template
        -->
      <providers>
        <clear />
      </providers>
    </roleManager>
    <!--
            If you are deploying to a cloud environment that has multiple web server instances,
            you should change session state mode from "InProc" to "Custom". In addition,
            change the connection string named "DefaultConnection" to connect to an instance
            of SQL Server (including SQL Azure and SQL  Compact) instead of to SQL Server Express.
      -->
    <sessionState mode="InProc" customProvider="DefaultSessionProvider">
      <providers>
        <add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" />
      </providers>
    </sessionState>
  </system.web>
  <system.webServer>
    <modules>
      <remove name="FormsAuthenticationModule" />
    </modules>
  </system.webServer>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="WebGrease" culture="neutral" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>
</configuration>

When I try the service with SOAP UI it appears like this:

    
asked by afar1793 21.09.2017 в 21:59
source

1 answer

0
  • Right-click on the file of your project in the Solution Explorer.
  • "Add Service Reference"
  • In the Address text box, select the physical path where you have the .WSDL file.
  • Click on Go.
  • PS: I have the Visual Studio in English so it would be direct in Spanish too.

        
    answered by 22.09.2017 в 02:19