服务器到服务器zip文件上传

我们正在尝试编译文件,并将文件以zip格式通过其提供的URL和凭据上传到供应商站点。 URL和凭据在脚本中。但是不会发生文件传输。我们正在Windows Server 2012 R2服务器上通过任务计划程序运行此程序。没有为出站或入站配置防火墙。服务器上的防火墙已禁用。

它们的网址包含/ api / 2 / batch / profile。如果我直接转到该路径,它会给我一个找不到的404文件。我添加了restapi / 2 / batch / profile,但出现以下错误。 服务器错误

404 - File or directory not found.
The resource you are looking for might have been removed,had its name 
changed,or is temporarily unavailable.

这是脚本文件(主脚本几行)

---------<add key="ZippedFile" value="filename.zip" />
-------- <add key="EmailHost" value="smtp.company.com" />
----------<add key="EmailPort" value="25" />
---------<add key="DateAuditsBeganInPD" value="2012-03-18" />
----------<add key="WebServiceURI" 
----------value="https://companyname.com/api/2/batch/profile"/>
----------<add key="UserId" value="userID"/>
--------- <add key="Password" value="password"/>
--------- <add key="UploadResponseFile" value="UploadResponse.txt"/>
-------</appSettings>

我没有收到任何错误消息。该文件未上传到他们的网站。但是,如果    我们通过CURL命令执行此操作,并尝试仅通过CURL上传文件    命令从该服务器或任何桌面上载它。

curl.exe -X POST -u "userID":"password" -H "content-type: multipart/form- 
data" --form "batch-file=@\\path to the zip file\filename.zip" --url 
"https://companyname.com/api/2/batch/profile"

这是完整的代码

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <section name="loggingConfiguration" type="microsoft.Practices.Enterpriselibrary.Logging.Configuration.LoggingSettings,microsoft.Practices.Enterpriselibrary.Logging,Version=5.0.505.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
    <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup,System,Version=4.0.0.0,PublicKeyToken=b77a5c561934e089">
      <section name="PolicyData.My.MySettings" type="System.Configuration.ClientSettingsSection,PublicKeyToken=b77a5c561934e089" requirePermission="false" />
      <section name="company.Analytics.PolicyData.My.MySettings" type="System.Configuration.ClientSettingsSection,PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    </sectionGroup>
    <!-- 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,PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <loggingConfiguration name="" tracingEnabled="true" defaultCategory="General">
    <listeners>
      <add name="Rolling flat File Trace Listener" type="microsoft.Practices.Enterpriselibrary.Logging.TraceListeners.RollingflatFileTraceListener,PublicKeyToken=31bf3856ad364e35" listenerDataType="microsoft.Practices.Enterpriselibrary.Logging.Configuration.RollingflatFileTraceListenerData,PublicKeyToken=31bf3856ad364e35" fileName="..\IO\PolicyData.log" footer="" formatter="Text Formatter" header="" rollSizeKB="5000" maxArchivedFiles="5" />
    </listeners>
    <formatters>
      <add type="microsoft.Practices.Enterpriselibrary.Logging.Formatters.TextFormatter,PublicKeyToken=31bf3856ad364e35" template="{timestamp(local)}  {message}" name="Text Formatter" />
    </formatters>
    <categorySources>
      <add switchValue="All" name="General">
        <listeners>
          <add name="Rolling flat File Trace Listener" />
        </listeners>
      </add>
    </categorySources>
    <specialSources>
      <allEvents switchValue="All" name="All Events" />
      <notProcessed switchValue="All" name="Unprocessed Category" />
      <errors switchValue="All" name="Logging Errors &amp; Warnings">
        <listeners>
          <add name="Rolling flat File Trace Listener" />
        </listeners>
      </errors>
    </specialSources>
  </loggingConfiguration>
  <connectionStrings>
    <add name="PD_CDB" connectionString="Data Source=db-pr-pd.company.com;Initial Catalog=BWCDB;uid=PDExternalAppsId;Password=password" />
    <add name="CLAIMSEntities" connectionString="metadata=res://*/ClaimsModel.csdl|res://*/ClaimsModel.ssdl|res://*/ClaimsModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=SQLCWSPROD;initial catalog=CLAIMS;integrated security=True;MultipleactiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
    <add name="GenBusinessEntities" connectionString="metadata=res://*/GenBusinessModel.csdl|res://*/GenBusinessModel.ssdl|res://*/GenBusinessModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=db-pr-genbusiness.company.com;initial catalog=GenBusiness;integrated security=True;MultipleactiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
    <add name="NLog" connectionString="Data Source=db-pr-appprog.company.com;Initial Catalog=ApplicationsProgramming;Trusted_Connection=True;" />
  </connectionStrings>
  <appSettings>
    <add key="PD_UserID" value="serviceaccount" />
    <add key="PD_Password" value="password" />
    <add key="PD_ClientID" value="14" />
    <add key="XMLManagerServiceURL" value="http://prod-app-net/PDSERVICES/WSXMLMANAGERSERVICEEX.ASMX" />
    <add key="OutputPath" value="\\appfiles01.company.com\PROD\VENDORNAME\PolicyData\IO" />
    <add key="ArchivePath" value="\\appfiles01.company.com\PROD\VENDORNAME\PolicyData\IO\archive" />
    <add key="ErrorPath" value="\\appfiles01.company.com\PROD\VENDORNAME\PolicyData\IO\error" />
    <add key="ShareFolder" value="\\appfiles01.company.com\PROD\VENDORNAME\PolicyData\IO\Share" />
    <add key="DataFolder" value="\\appfiles01.company.com\PROD\VENDORNAME\PolicyData\IO\Data "/>
    <add key="InsuredFile" value="insured.psv" />
    <add key="TermFile" value="term.psv" />
    <add key="StateFile" value="state.psv" />
    <add key="ClassFile" value="class.psv" />
    <add key="ClaimFile" value="claim.psv" />
    <add key="ClaimDetailFile" value="claim_detail.psv" />
    <add key="ZippedFile" value="companyPolicyData.DEV.zip" />
    <add key="EmailHost" value="smtp.company.com" />
    <add key="EmailPort" value="25" />
    <add key="DateAuditsBeganInPD" value="2012-03-18" />
    <add key="VENDORNAMEWebServiceURI" value="https://insureright.VENDORNAME.com/api/2/batch/profile"/>
    <add key="VENDORNAMEUserId" value="test@company.com"/>
    <add key="VENDORNAMEPassword" value="password"/>
<add key="UploadResponseFile" value="UploadResponse.txt"/>
    </appSettings>
  <system.diagnostics>
    <sources>
      <!-- This section defines the logging configuration for My.Application.Log -->
      <source name="Defaultsource" switchName="DefaultSwitch">
        <listeners>
          <add name="FileLog" />
          <!-- Uncomment the below section to write to the Application Event Log -->
          <!--<add name="EventLog"/>-->
        </listeners>
      </source>
    </sources>
    <switches>
      <add name="DefaultSwitch" value="Information" />
    </switches>
    <sharedListeners>
      <add name="FileLog" type="microsoft.VisualBasic.Logging.FileLogTraceListener,microsoft.VisualBasic,Version=8.0.0.0,PublicKeyToken=b03f5f7f11d50a3a,processorArchitecture=MSIL" initializeData="FileLogWriter" />
      <!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log -->
      <!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
    </sharedListeners>
  </system.diagnostics>
  <system.serviceModel>
    <bindings>
      <wsHttpBinding>
        <binding name="BasicHttpEndpoint">
          <security mode="Transport" />
        </binding>
        <binding name="WSHttpBinding_ICommon">
          <security mode="Transport" />
        </binding>
        <binding name="WSHttpBinding_IBranding">
          <security mode="Transport" />
        </binding>
      </wsHttpBinding>
    </bindings>
    <client>
      <endpoint address="https://agencyservices.company.com/companyBiz.svc" binding="wsHttpBinding" bindingConfiguration="BasicHttpEndpoint" contract="AgencyService.IcompanyBiz" name="BasicHttpEndpoint" />
      <endpoint address="https://commonservices.company.com/Common.svc" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_ICommon" contract="CommonService.ICommon" name="WSHttpBinding_ICommon" />
      <endpoint address="https://commonservices.company.com/Branding.svc" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IBranding" contract="BrandService.IBranding" name="WSHttpBinding_IBranding" />
    </client>
  </system.serviceModel>
  <applicationSettings>
    <PolicyData.My.MySettings>
      <setting name="PolicyGapData_XMLManagerServiceEx_WSXMLManagerServiceEx" serializeAs="String">
        <value>http://tst-iisapp-net/PDSERVICES/WSXMLMANAGERSERVICEEX.ASMX</value>
      </setting>
    </PolicyData.My.MySettings>
  </applicationSettings>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
  </startup>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory,EntityFramework">
      <parameters>
        <parameter value="mssqllocaldb" />
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices,EntityFramework.SqlServer" />
    </providers>
  </entityFramework>
</configuration>`enter code here`

这是我们要使用其凭据将压缩文件传输到的URL。

<add key="VENDORNAMEWebServiceURI" value="https://insureright.VENDORNAME.com/api/2/batch/profile"/>
<add key="VENDORNAMEUserId" value="test@company.com"/>
<add key="VENDORNAMEPassword" value="password"/>
book1928 回答:服务器到服务器zip文件上传

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3150310.html

大家都在问