2012-01-08 31 views
0

私はサービスを実行するたびに応答することはありません、私はそれが実行されている別のaspxファイルで実行されている類似しているようにサービスではないことを知っています。私はそれを調べましたが、それはweb.configファイルと関係がありますが、私はどこにいるのかわかりません。私は小さなWeb設定ファイルを与えられましたが、あなたがそれをコーディングの特定の1つの行が気に入らないと言う場所に置くと、パーティーがASP.Netでエラーに応答しなかったため接続に失敗しました。

これは私が取得していますエラーです:

<%@ Page Language="vb" Debug="true" %> 
<%@ Import Namespace = "HSBC" %> 

<script runat="server"> 

    'Page Load 
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) 

     Dim sortcode As String = CType(Session.Item("sessionsortnum"), String) 
     Dim accountnumber As String = CType(Session.Item("sessionaccount"), String) 
     Dim selectcase As String = CType(Session.Item("sessioncase"), String) 

     testsort.Text = sortcode 
     testbank.Text = accountnumber 
     testselectc.Text = selectcase 

    End Sub 

    'Check Balance 
    Private Sub checkbalance(ByVal sender As Object, ByVal e As System.EventArgs) 
     Dim balance As New test.HSBC() 
     Dim sortcode As String = CType(Session.Item("sessionsortnum"), String) 
     Dim accountnumber As String = CType(Session.Item("sessionaccount"), String) 
     Dim selectcase As String = CType(Session.Item("sessioncase"), String) 
     testsort.Text = sortcode 
     testbank.Text = accountnumber 
     testselectc.Text = selectcase 

     Response.Write(sortcode & " " & accountnumber & " " & selectcase) 

     screen.Text = balance.CheckBalance(accountnumber) 
    End Sub 

    Private Sub withdraw(ByVal sender As Object, ByVal e As System.EventArgs) 

     'Session("moneyamount") = amountchoice.Text 

     Dim balance As New test.HSBC() 
     Dim sortcode As String = CType(Session.Item("sessionsortnum"), String) 
     Dim accountnumber As String = CType(Session.Item("sessionaccount"), String) 
     Dim selectcase As String = CType(Session.Item("sessioncase"), String) 
     Dim amount As String = CType(Session.Item("moneyamount"), String) 

     testsort.Text = sortcode 
     testbank.Text = accountnumber 
     testselectc.Text = selectcase 

     Response.Write(sortcode & " " & accountnumber & " " & selectcase & " " & amount) 

     screen.Text = balance.Withdraw(accountnumber, amount) 

    End Sub 
</script> 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head id="Head1" runat="server"> 
    <title>Welcome to HSBC</title> 
</head> 
<body> 
    <form id="form1" runat="server" method="post"> 
    <asp:Panel ID="Panel3" runat="server" style="top: 15px; left: 10px; position: absolute; height: 225px; width: 200px"> 
    </asp:Panel> 


    <br /> 
    <br /> 
    <br /> 


      <asp:Panel ID="Panel2" runat="server" Height="490px" Width="1024px" style="top: 17px; left: 10px; position: absolute"> 

         <%-- Onclick is to put the numbers into the textbox --%> 
         <asp:button ID="btn1" runat="server" Text="1" width= "334px" height= "118px" style="top: 249px; left: 15px; position: absolute" /> 
         <asp:button ID="btn2" runat="server" Text="2" width= "334px" height= "118px" style="top: 249px; left: 355px; position: absolute" /> 
         <asp:button ID="btn3" runat="server" Text="3" height= "118px" style="top: 249px; left: 694px; position: absolute; width: 328px;" /> 
         <asp:button ID="btn4" runat="server" Text="4" width= "334px" height= "118px" style="top: 372px; left: 15px; position: absolute; right: 1021px;" /> 
         <asp:button ID="btn5" runat="server" Text="5" width= "334px" height= "118px" style="top: 372px; left: 355px; position: absolute" /> 
         <asp:Button ID="btn6" runat="server" Text="6" height="118px" style="top: 372px; left: 695px; position: absolute; width: 327px;" /> 
         <asp:button ID="btn7" runat="server" Text="7" width= "334px" height= "118px" style="top: 495px; left: 15px; position: absolute" /> 
         <asp:button ID="btn8" runat="server" Text="8" width= "334px" height= "118px" style="top: 495px; left: 356px; position: absolute" /> 
         <asp:Button ID="btn9" runat="server" Text="9" height="118px" style="top: 495px; left: 694px; position: absolute; width: 329px;" /> 
         <asp:button ID="btn0" runat="server" Text="0" width= "334px" height= "118px" style="top: 618px; left: 356px; position: absolute" /> 

          <%-- Points to Visa Web Service to use their services --%> 
          <asp:button ID="submit" runat="server" Text="Enter" height= "118px" style="top: 618px; left: 695px; position: absolute; width: 327px;" /> 

          <%-- Clears the text box --%> 
          <asp:Button ID="cancel" runat="server" Text="Cancel/Clear" height="118px" style="top: 618px; left: 15px; position: absolute" width="334px" /> 

         <asp:Panel ID="Panel4" runat="server" style="top: 1px; left: 827px; position: absolute; height: 221px; width: 196px"> 
          <asp:Button ID="Button7" runat="server" 
           style="width: 195px; height: 46px; top: 1px; left: -210px; position: absolute" 
           Text="Check Balance" onclick="checkbalance" /> 
          <asp:Button ID="Button8" runat="server" 
           style="width: 195px; height: 46px; top: 61px; left: -200px; position: absolute" 
           Text="Withdraw Cash" onclick="withdraw" /> 

         </asp:Panel> 

         <asp:Label ID="lblBalance" runat="server"></asp:Label> 
         <asp:TextBox ID="screen" runat="server" 

          style="width: 383px; height: 214px; top: 8px; left: 221px; position: absolute"></asp:TextBox> 
      </asp:Panel> 
     &nbsp;<asp:Label ID="testbank" runat="server"></asp:Label> 
          <br /> 
          <br /> 
          <asp:Label ID="testsort" runat="server"></asp:Label> 
          <br /> 
          <br /> 
          <asp:Label ID="testselectc" runat="server"></asp:Label> 
          <br /> 
          <br /> 
          </form> 
     </body> 
</html> 

エラーは、それが実際の呼び出しに一部screen.Text = balance.Withdraw(accountnumber, amount)だ私に語った:

Server Error in '/webroot' Application. A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 195.195.43.253:880 Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 195.195.43.253:880

Source Error: Line 29: Response.Write(sortcode & " " & accountnumber & " " & selectcase) Line 30:
Line 31: screen.Text = balance.CheckBalance(accountnumber) Line 32: End Sub Line 33:

Source File: H:\webroot\menu.aspx Line: 31

Stack Trace:

[SocketException (0x274c): A connection attempt failed because the connected party did >not properly respond after a period of time, or established connection failed because >connected host has failed to respond 195.195.43.253:880] System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress >socketAddress) +239 System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP) +35 System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, >Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult >asyncResult, Int32 timeout, Exception& exception) +224

[WebException: Unable to connect to the remote server] System.Net.HttpWebRequest.GetRequestStream(TransportContext& context) +1872945 System.Net.HttpWebRequest.GetRequestStream() +13 System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, >Object[] parameters) +103 test.HSBC.CheckBalance(Int64 accountnumber) +72 ASP.menu_aspx.checkbalance(Object sender, EventArgs e) in H:\webroot\menu.aspx:31 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(St>ring eventArgument) +10 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String >eventArgument) +13 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean >includeStagesAfterAsyncPoint) +1565

Version Information: Microsoft .NET Framework Version:2.0.50727.5448; ASP.NET >Version:2.0.50727.5420

これは、ASMXファイルです。私はそれが画面に変数に何を書いていたコメントしたので、それが働いていることを知っています。

これは、ASMXファイル

<%@ WebService Language="vb" Class="HSBC" %> 
Imports System 
Imports System.Web.Services 
Imports System.Xml.Serialization 
Imports System.Data 
Imports System.Data.OleDb 
Imports System.Web.Services.Protocols 

'Imports everything that is needed ready to use within the web services 

<WebService(Namespace:="http://heweb.grimsby.ac.uk/s0082708/")> Public Class HSBC 

    'Public to allow access 


    Inherits System.Web.Services.WebService 

    Public AuthSoapHd As New AuthenticationHeader 

    'Inherits the imports to use in the web service 

    Public Auth As New AuthenticationHeader 

    '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    '             Unsecure Balance Call 
    '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 

    <WebMethod()> Public Function CheckBalance(ByVal accountnumber As Long) As String 
     Return CheckBal(accountnumber)  
    End Function 


    '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    '             Check Balance Call - Secure (SOAP HEADER AUTH) 
    '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 

    '<WebMethod(), SoapHeader("Auth")> Public Function AuthCheckBalance(ByVal accountnumber As Long) As String 
    ' If (Auth.username = "HSBC" And Auth.password = "HSBC") Then 
    '  Return CheckBal(accountnumber) 
    ' Else 
    ' Throw New Exception("Did not manage to login") 
    ' End If 

    'End Function 

    '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    '         Check Balance function 
    '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 

    'Creates a service web method 

    Private Function CheckBal(ByVal accountnumber As Long) As String 

     Dim account As String = CType(Session.Item("sessionaccount"), String) 

     'Database drivers, connections and commands 
     Dim BalanceDr As OleDbDataReader 
     Dim BalanceConn As OleDbConnection 
     Dim BalanceCmd As OleDbCommand 

     'Database connection string 
     Dim Connx As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("../database/HSBC.mdb") & ";" 

     'SQL 

     Dim SQL As String = "SELECT Transaction_Amount FROM Transaction WHERE Account_Number = " & _ 
     account 

     Dim bal As String 

     'Open the connection to the database 
     BalanceConn = New OleDbConnection(Connx) 
     BalanceCmd = New OleDbCommand(SQL, BalanceConn) 
     BalanceConn.Open() 

     'Create a DataReader that will return information. 
     BalanceDr = _ 
     BalanceCmd.ExecuteReader(CommandBehavior.CloseConnection) 

     If BalanceDr.Read() Then 
      'A row was returned 
      bal = BalanceDr(0) 
     Else 
      'A row was not returned 
      bal = "No Name Found" 
     End If 

     BalanceDr.Close() 
     Return bal 
    End Function 
End Class 

であり、これはウェブの設定ファイルは何かということです:

<?xml version="1.0"?> 
<configuration> 
    <configSections> 
     <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> 
      <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> 
       <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/> 
       <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> 
        <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/> 
        <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/> 
        <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/> 
        <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/> 
       </sectionGroup> 
      </sectionGroup> 
     </sectionGroup> 
    </configSections> 
    <appSettings> 
     Web references sit here 
    </appSettings> 
    <connectionStrings/> 
    <system.web> 

     <compilation debug="false"> 
      <assemblies> 
       <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> 
       <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
       <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> 
       <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> 
      </assemblies> 
     </compilation> 
     <!-- 
      The <authentication> section enables configuration 
      of the security authentication mode used by 
      ASP.NET to identify an incoming user. 
     --> 
     <authentication mode="Windows"/> 
     <!-- 
      The <customErrors> section enables configuration 
      of what to do if/when an unhandled error occurs 
      during the execution of a request. Specifically, 
      it enables developers to configure html error pages 
      to be displayed in place of a error stack trace. 

     <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm"> 
      <error statusCode="403" redirect="NoAccess.htm" /> 
      <error statusCode="404" redirect="FileNotFound.htm" /> 
     </customErrors> 
     --> 
     <pages> 
      <controls> 
       <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
       <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
      </controls> 
     </pages> 
     <httpHandlers> 
      <remove verb="*" path="*.asmx"/> 
      <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
      <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
      <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/> 
     </httpHandlers> 
     <httpModules> 
      <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
     </httpModules> 
    </system.web> 
    <system.codedom> 
     <compilers> 
      <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> 
       <providerOption name="CompilerVersion" value="v3.5"/> 
       <providerOption name="WarnAsError" value="false"/> 
      </compiler> 
      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" warningLevel="4" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> 
       <providerOption name="CompilerVersion" value="v3.5"/> 
       <providerOption name="OptionInfer" value="true"/> 
       <providerOption name="WarnAsError" value="false"/> 
      </compiler> 
     </compilers> 
    </system.codedom> 
    <!-- 
     The system.webServer section is required for running ASP.NET AJAX under Internet 
     Information Services 7.0. It is not necessary for previous version of IIS. 
    --> 
    <system.webServer> 
     <validation validateIntegratedModeConfiguration="false"/> 
     <modules> 
      <remove name="ScriptModule"/> 
      <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
     </modules> 
     <handlers> 
      <remove name="WebServiceHandlerFactory-Integrated"/> 
      <remove name="ScriptHandlerFactory"/> 
      <remove name="ScriptHandlerFactoryAppServices"/> 
      <remove name="ScriptResource"/> 
      <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
      <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
      <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
     </handlers> 
    </system.webServer> 
    <runtime> 
     <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> 
      <dependentAssembly> 
       <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/> 
       <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/> 
      </dependentAssembly> 
      <dependentAssembly> 
       <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/> 
       <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/> 
      </dependentAssembly> 
     </assemblyBinding> 
    </runtime> 
</configuration> 

誰もが、それは、接続に失敗する原因となっている任意のアイデアを持っていますか?

答えて

0

ウェブ設定で間違ってリダイレクトされました。

http://www.example.com:808/example

は808なしで他のすべてのようなアドレスで808を削除し、それが直接仮想不満として、それが正常に動作しているようだ、それはUSBメモリから実行していたので、それが動作しているようです今。だから他の誰かがこの問題を抱えていると、あなたのweb.configのweb ref部分をチェックしてください。

関連する問題