无法配置端点

我正在开发一个项目,其中一个团队创建了wcf服务,而我们的MVC团队必须使用该服务并将参数传递给该服务。 在以不同的方式调用服务时,由于以下错误,我们无法调用该服务:

  • 由于目标机器主动拒绝它127.0.0.1:1295,所以不能建立连接
  • 没有配置端点
  • 端点不在监听
  • 无法在服务模型客户端配置中找到端点“”和合同。
  • 远程服务器返回500(内部错误)
  • 请帮忙

       [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/87201.html

    上一篇: Unable to configure endpoints

    下一篇: Endpoint is not showing