简体   繁体   English

System.Net.WebException:远程服务器返回错误:(500)内部服务器错误。

[英]System.Net.WebException: The remote server returned an error: (500) Internal Server Error.

System.Net.WebException: The remote server returned an error: (500) Internal Server Error. System.Net.WebException:远程服务器返回错误:(500)内部服务器错误。 at System.Net.HttpWebRequest.GetResponse() at SMS.Testpage.btnsubmit_Click(Object sender, EventArgs e) 在System.Net.HttpWebRequest.GetResponse()在SMS.Testpage.btnsubmit_Click(Object sender,EventArgs e)

this is the error im getting when my im uploading my files to the remote server. 这是我将文件上传到远程服务器时收到的错误消息。 As in case of local host it is working fine and returning the same wat i am expecting , but im not getting why it is behaving like this , if any one having the idea on my errors , plz let me get out of this big issue.I really struggling with this issue since 3 weeks. 就像在本地主机的情况下一样,它可以正常工作并返回我期望的相同值,但是我无法理解为什么这样做,如果有人对我的错误有想法,请让我摆脱这个大问题。自3个星期以来,我真的在这个问题上苦苦挣扎。

Here is my web config code--- 这是我的网络配置代码-

<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>

Your code is crashing when it runs in the server. 您的代码在服务器中运行时崩溃。 You need to get more details about why it is crashing inorder to fix it. 您需要获取有关其崩溃原因的更多详细信息,以便对其进行修复。 The first thing to do is to update the web config so that it can give you more details of the error. 首先要做的是更新Web配置,以便它可以为您提供有关错误的更多详细信息。 Set the customErrors element's mode property value to "Off" 将customErrors元素的mode属性值设置为“ Off”

<system.web>
    <customErrors mode="Off" />
    //Other items goes here
</system.web>

The possible reasons i can think of are 我能想到的可能原因是

  1. You have an incorrect connection string. 您的连接字符串不正确。 Some have the code is not able to access your db server. 有些代码无法访问您的数据库服务器。 Double check the db server name is correct. 仔细检查数据库服务器名称是否正确。

  2. The code do not have permissions to write to some directory (When you do a file upload, you need to make sure that the directories permission's are updated so that ASP.NET can write to that folder). 该代码没有写某目录的权限(上传文件时,需要确保已更新目录的权限,以便ASP.NET可以写入该文件夹)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 System.Net.WebException-内部服务器错误500 - System.Net.WebException - Internal Server error 500 修复 - System.Net.WebException:远程服务器返回错误:(500) 语法错误,命令无法识别 - Fixing - System.Net.WebException: The remote server returned an error: (500) Syntax error, command unrecognized System.Net.WebException:远程服务器返回错误:(403)禁止 - System.Net.WebException: The remote server returned an error: (403) Forbidden System.Net.WebException:远程服务器返回错误:(403)禁止 - System.Net.WebException : The remote server returned an error: (403) Forbidden 硒:意外错误。 System.Net.WebException:无法连接到远程服务器 - Selenium:Unexpected error. System.Net.WebException: Unable to connect to the remote server System.Net.WebException:远程服务器返回错误:(401)未经授权。 在System.Net.HttpWebRequest.GetResponse() - System.Net.WebException: The remote server returned an error: (401) Unauthorized. at System.Net.HttpWebRequest.GetResponse() Jenkins + Sonarqube-未处理的异常:System.Net.WebException:远程服务器返回错误:(401)未经授权 - Jenkins + Sonarqube - Unhandled Exception: System.Net.WebException: The remote server returned an error: (401) Unauthorized System.Net.WebException:远程服务器返回错误:(403)访问Google API时禁止访问 - System.Net.WebException: The remote server returned an error: (403) Forbidden when access Google API System.Net.WebException:远程服务器返回错误:(429)请求太多 - System.Net.WebException: The remote server returned an error: (429) Too Many Requests FtpWebRequest引发System.Net.WebException:远程服务器返回错误:(530)未登录 - FtpWebRequest throws System.Net.WebException: The remote server returned an error: (530) Not logged in
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM