2015-05-03 153 views
0

System.Net.WebException:远程服务器返回错误:(500)内部服务器错误。在System.Net.HttpWebRequest.GetResponse()在SMS.Testpage.btnsubmit_Click(对象发件人,EventArgs e)System.Net.WebException:远程服务器返回错误:(500)内部服务器错误。

这是我得到当我上传我的文件到远程服务器的错误。在本地主机的情况下,它工作正常,并返回我期待的相同的扫描笏,但我不明白为什么它的行为是这样的,如果有人对我的错误有想法,请让我摆脱这个大问题。自3周以来,我一直在努力解决这个问题。

这里是我的web配置的代码---当它在服务器运行

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

调试您的服务器或查看日志找到确切的问题,不可能找到没有信息的问题。 –

回答

1

您的代码崩溃。你需要获得更多关于它为什么会崩溃的细节,以便解决它。首先要做的是更新Web配置,以便它可以提供有关错误的更多详细信息。设置的customErrors元素的模式属性值设置为“关”

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

我能想到的,可能的原因是

  1. 你有一个不正确的连接字符串。有些代码不是 能够访问您的数据库服务器。仔细检查数据库服务器的名称是否为 正确。

  2. 该代码没有写入某个目录的权限(当您执行文件上载时,需要确保目录权限已更新,以便ASP.NET可以写入该文件夹)。

+0

我没有得到问题..这一个是和db部分工作完美。这一个代码为web cofig和在本地主机工作良好.. – Pradeep

+0

我不知道abt作为直接权限,因为它是为其他文件工作看起来不错.. – Pradeep

相关问题