[英]System.Net.WebException: The remote server returned an error: (500) Internal Server Error.
System.Net.WebException:遠程服務器返回錯誤:(500)內部服務器錯誤。 在System.Net.HttpWebRequest.GetResponse()在SMS.Testpage.btnsubmit_Click(Object sender,EventArgs e)
這是我將文件上傳到遠程服務器時收到的錯誤消息。 就像在本地主機的情況下一樣,它可以正常工作並返回我期望的相同值,但是我無法理解為什么這樣做,如果有人對我的錯誤有想法,請讓我擺脫這個大問題。自3個星期以來,我真的在這個問題上苦苦掙扎。
這是我的網絡配置代碼-
<configuration>
<connectionStrings>
<add name="mydbcon" connectionString="Data Source=xyz;Initial Catalog=smspro;Persist Security Info=True;User ID=xyz;Password=xyz" />
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime />
<webServices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
</webServices>
<!--<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>-->
</system.web>
<appSettings />
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="epBasicHttp" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm=""/>
<message clientCredentialType="UserName" algorithmSuite="Default"/>
</security>
</binding>
</basicHttpBinding>
<netTcpBinding>
<binding name="tcpBinding" receiveTimeout="00:15:00" sendTimeout="00:15:00" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647">
<security mode="None">
<transport clientCredentialType="None" protectionLevel="None" />
<message clientCredentialType="None" />
</security>
</binding>
<!--<binding name="epNetTcp" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions" hostNameComparisonMode="StrongWildcard" listenBacklog="10" maxBufferPoolSize="524288" maxBufferSize="65536" maxConnections="10" maxReceivedMessageSize="65536">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/`enter code here`>
<reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false"/>
<security mode="None">
<transport clientCredentialType="Windows" protectionLevel="EncryptAndSign"/>
<message clientCredentialType="Windows"/>
</security>
</binding>-->
</netTcpBinding>
</bindings>
<services>
<service name="SMS.Services.Communication">
<endpoint address="http://localhost:3053/Services/Communication.svc" binding="webHttpBinding" contract="SMS.Services.ICommunication"
behaviorConfiguration="Web"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="Web">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment minFreeMemoryPercentageToActivateService="0"/>
<!--<serviceHostingEnvironment minFreeMemoryPercentageToActivateService="0" />-->
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
您的代碼在服務器中運行時崩潰。 您需要獲取有關其崩潰原因的更多詳細信息,以便對其進行修復。 首先要做的是更新Web配置,以便它可以為您提供有關錯誤的更多詳細信息。 將customErrors元素的mode屬性值設置為“ Off”
<system.web>
<customErrors mode="Off" />
//Other items goes here
</system.web>
我能想到的可能原因是
您的連接字符串不正確。 有些代碼無法訪問您的數據庫服務器。 仔細檢查數據庫服務器名稱是否正確。
該代碼沒有寫某目錄的權限(上傳文件時,需要確保已更新目錄的權限,以便ASP.NET可以寫入該文件夾)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.