Wednesday, March 28, 2012

Web.Config Issues?

Folks,
I'm hosting through 1and1.com. I don't have a lot of experience
deploying asp.net apps on shared webservers.
I keep getting the following error message when trying to have my
ASP.Net (2.0) web service access the SQL 2000 database:
System.Web.Services.Protocols.SoapException was unhandled
Actor=""
Lang=""
Message="System.Web.Services.Protocols.SoapException: Server was
unable to process request. --> System.InvalidCastException: Conversion
from string "Data Source=mssql06.1and1.com;In" to type 'Integer' is not
valid. --> System.FormatException: Input string was not in a correct
format.
at
Microsoft.VisualBasic.CompilerServices.Conversions.ParseDouble(String
Value, NumberFormatInfo NumberFormat)
This does not make sense why is would be trying to convert my web.config
connection string into an integer.
Here's my web.config file:
<?xml version="1.0"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<appSettings/>
<connectionStrings>
<add name="Web_LocatorConnectionString" connectionString="Data
Source=mssql06.1and1.com;Initial Catalog=db181902399;User
ID=dbo181902399;Password=xxxxx" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
Visual Basic options:
Set strict="true" to disallow all data type conversions
where data loss can occur.
Set explicit="true" to force declaration of all variables.
-->
<compilation debug="false" strict="false" explicit="true"/>
<pages>
<namespaces>
<clear/>
<add namespace="System"/>
<add namespace="System.Collections"/>
<add namespace="System.Collections.Specialized"/>
<add namespace="System.Configuration"/>
<add namespace="System.Text"/>
<add namespace="System.Text.RegularExpressions"/>
<add namespace="System.Web"/>
<add namespace="System.Web.Caching"/>
<add namespace="System.Web.SessionState"/>
<add namespace="System.Web.Security"/>
<add namespace="System.Web.Profile"/>
<add namespace="System.Web.UI"/>
<add namespace="System.Web.UI.WebControls"/>
<add namespace="System.Web.UI.WebControls.WebParts"/>
<add namespace="System.Web.UI.HtmlControls"/>
</namespaces>
</pages>
<customErrors mode="Off"/>
</system.web>
</configuration>
Thanks for any help and insight!> unable to process request. --> System.InvalidCastException: Conversion
> from string "Data Source=mssql06.1and1.com;In" to type 'Integer' is not
> valid. --> System.FormatException: Input string was not in a correct
> format.
> at
> Microsoft.VisualBasic.CompilerServices.Conversions.ParseDouble(String
> Value, NumberFormatInfo NumberFormat)
Probably somewhere you code is doing that... accidently!
Is there any thing more in the stack trace?
Happy Hacking,
Gaurav Vaish | www.mastergaurav.com
www.edujini-labs.com
http://eduzine.edujinionline.com
---
Here is the full stack trace:
Again, this line is in my web.config file, not a line of code.
System.Web.Services.Protocols.SoapException was unhandled
Actor=""
Lang=""
Message="System.Web.Services.Protocols.SoapException: Server was
unable to process request. --> System.InvalidCastException: Conversion
from string "Data Source=mssql06.1and1.com;In" to type 'Integer' is not
valid. --> System.FormatException: Input string was not in a correct
format.
at
Microsoft.VisualBasic.CompilerServices.Conversions.ParseDouble(String
Value, NumberFormatInfo NumberFormat)
at
Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger(String Value)
-- End of inner exception stack trace --
at
Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger(String Value)
at UploadData.UL_Equipment(Locator_DataSet RemoteDS)
-- End of inner exception stack trace --"
Node=""
Role=""
Source="System.Web.Services"
StackTrace:
at
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClient
Message
message, WebResponse response, Stream responseStream, Boolean asyncCall)
at
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters)
at TestWS.localhost.UploadData.UL_Equipment(Locator_DataSet
RemoteDS) in D:\Net Dev\AM_LocateMgr\TestWS\TestWS\Web
References\localhost\Reference.vb:line 179
at TestWS.Form1.btnSaveData_Click(Object sender, EventArgs e) in
D:\Net Dev\AM_LocateMgr\TestWS\TestWS\Form1.vb:line 31
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m,
MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at
System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at
System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr
hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at
System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at
System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.Unsaf
eNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32
dwComponentID, Int32 reason, Int32 pvLoopData)
at
System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32
reason, ApplicationContext context)
at
System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32
reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(ApplicationContext context)
at
Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun(
)
at
Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoAppl
icationModel()
at
Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(St
ring[]
commandLine)
at TestWS.My.MyApplication.Main(String[] Args) in
17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[]
args)
at System.AppDomain.ExecuteAssembly(String assemblyFile,
Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
Gaurav Vaish (MasterGaurav) wrote:
> Probably somewhere you code is doing that... accidently!
> Is there any thing more in the stack trace?
>
> at TestWS.localhost.UploadData. UL_Equipment(Locator_DataSeted">
> RemoteDS) in D:\Net Dev\AM_LocateMgr\TestWS\TestWS\Web
> References\localhost\Reference.vb:line 179
Seems to me that you have a proxy-client for a web-service on "localhost".
Now that it is trying to connect to the service on "localhost", it does not
exist in a shared-web-hosting.
You will need to update it appropriately.
Also, it seems that the client expects an integer while the service has been
modified (or, in my opinion, wrongly referenced) and returns a string.
Happy Hacking,
Gaurav Vaish | www.mastergaurav.com
www.edujini-labs.com
http://eduzine.edujinionline.com
---
I have modified the URL in code, the service was developed locally
(hence the localhost reference). It is connecting to the proper public
url, but with the error I indicated.
The line referenced is the connection string line in the web.config
file. It is a connection string, which should be a string. What would
make ASP.Net try to turn it into an integer?
Thanks!
Wayne Pedersen
Gaurav Vaish (MasterGaurav) wrote:
> Seems to me that you have a proxy-client for a web-service on "localhost".
> Now that it is trying to connect to the service on "localhost", it does no
t
> exist in a shared-web-hosting.
> You will need to update it appropriately.
> Also, it seems that the client expects an integer while the service has be
en
> modified (or, in my opinion, wrongly referenced) and returns a string.
>
> The line referenced is the connection string line in the web.config file.
> It is a connection string, which should be a string. What would make
> ASP.Net try to turn it into an integer?
That's what keeps me wondering still now.
I think it's impossible to provide any support unless there's a p on the
code :(
Happy Hacking,
Gaurav Vaish | www.mastergaurav.com
www.edujini-labs.com
http://eduzine.edujini-labs.com
---
Code:
Desktop App (Consuming web service):
Public Class Form1
Dim svc As New localhost.UploadData
Private Sub btnGetData_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnGetData.Click
Dim ds As New localhost.Locator_DataSet
ds = svc.GetEquip
Grid.DataSource = ds
Grid.DataMember = "Equipment"
End Sub
Private Sub btnSaveData_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles btnSaveData.Click
Dim ds As New localhost.Locator_DataSet
For x As Integer = 80 To 100
Dim newRow As DataRow = ds.Equipment.NewRow
newRow.Item("EquipmentID") = x
newRow.Item("Name") = "Test Record " & x
ds.Equipment.Rows.Add(newRow)
Next
svc.UL_Equipment(ds)
ds.Clear()
ds = svc.GetEquip
Grid.DataSource = ds
Grid.DataMember = "Equipment"
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
svc.Url = "http://www.ariesearch.com/datamerge/UploadData.asmx"
End Sub
End Class
WebService (Serving the GetEquip Routine):
<WebMethod()> _
Public Function GetEquip() As DataMerge.Data.Locator_DataSet
ta_Equip.Fill(ds_Loc.Equipment)
Return ds_Loc
End Function
Gaurav Vaish (www.edujini-labs.com) wrote:
> That's what keeps me wondering still now.
> I think it's impossible to provide any support unless there's a p on th
e
> code :(
>
> Desktop App (Consuming web service):
Strange!
Nothing fishy in this.
At the moment, I'm nothing but totally clueless. :(
Happy Hacking,
Gaurav Vaish | www.mastergaurav.com
www.edujini-labs.com
http://eduzine.edujini-labs.com
---

0 comments:

Post a Comment