无法在同一解决方案中调用Web Service的方法

时间:2019-08-05 15:36:10

标签: c# .net visual-studio web-services

在我的解决方案中,我首先创建一个控制台项目,然后使用一种服务方法创建另一个Web服务项目,我想使用该服务项目的服务方法,因此我将Web服务引用添加到控制台项目中,但是当我在控制台项目中调用service方法时,它总是提醒我“目标计算机正在主动拒绝”。

有人说这是港口的问题。

这是Setting.Designer.cs文件的代码:

[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.1.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {

    private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));

    public static Settings Default {
        get {
            return defaultInstance;
        }
    }

    [global::System.Configuration.ApplicationScopedSettingAttribute()]
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.WebServiceUrl)]
    [global::System.Configuration.DefaultSettingValueAttribute("https://localhost:44321/ExtractName.asmx")]
    public string SystemClass_iCloudExtract_ExtractName {
        get {
            return ((string)(this["SystemClass_iCloudExtract_ExtractName"]));
        }
    }
}

这是控制台项目的app.config文件的代码:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
      <section name="SystemClass.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    </sectionGroup>
  </configSections>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Office.Interop.Word" publicKeyToken="71e9bce111e9429c" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <applicationSettings>
    <SystemClass.Properties.Settings>
      <setting name="SystemClass_iCloudExtract_ExtractName" serializeAs="String">
        <value>https://localhost:44321/Extractame.asmx</value>
      </setting>
    </SystemClass.Properties.Settings>
  </applicationSettings>
</configuration>

错误是“目标计算机主动拒绝”。

0 个答案:

没有答案