Unable to configure endpoints

I am working on a project where one team created wcf service and we MVC team has to consume that service and passing parameters to that service. On going with different ways of calling the service we are unable to call that service because of the following errors:

  • No connection could be made because the target machine actively refused it 127.0.0.1:1295
  • No endpoint configured
  • Endpoint is not listening
  • Could not find endpoint "" and contract in service model client configuration.
  • Remote server returning 500 (Internal error)
  • Please help

       [ServiceContract]
        public interface ITnTService
        {
    
            [OperationContract]      
            List<GetCity_Result> Getcity();
    
            [OperationContract]
            bool PContact(Person item);
    }
    

    Web.config

        <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <configSections>
    
        <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    
      <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --></configSections>
      <appSettings>
        <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
      </appSettings>
      <system.web>
        <compilation debug="true" targetFramework="4.5">
          <assemblies>
            <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
          </assemblies>
        </compilation>
        <httpRuntime targetFramework="4.5" />
      </system.web>
      <system.serviceModel>
    <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" />
            </behavior>
          </serviceBehaviors>
        </behaviors>
        <protocolMapping>
          <add binding="basicHttpsBinding" scheme="https" />
        </protocolMapping>
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
    <services>
          <service name="TnT.Services.TnTService">
            <endpoint address="basic1" binding="basicHttpBinding" contract="TnT.Services.ITnTService"/>
          </service>
        </services>
    
      </system.serviceModel>
      <system.webServer>
        <modules runAllManagedModulesForAllRequests="true" />
     <directoryBrowse enabled="true" />
      </system.webServer>
      <connectionStrings>
        <add name="TnTEntities" connectionString="metadata=res://*/TnT_Model.csdl|res://*/TnT_Model.ssdl|res://*/TnT_Model.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=183.82.48.194;initial catalog=TnT;persist security info=True;user id=dev;password=dev;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
      </connectionStrings>
      <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>
    

    在你的配置文件中没有baseaddress:

    <services>
      <service name="TnT.Services.TnTService">
        <endpoint address="basic1" binding="basicHttpBinding" contract="TnT.Services.ITnTService"/>
    
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:1295"/>
          </baseAddresses>
        </host>
      </service>
    </services>
    
    链接地址: http://www.djcxy.com/p/87202.html

    上一篇: 使用Java将十六进制转储的字符串表示形式转换为字节数组?

    下一篇: 无法配置端点