Visual Studio 2010 Express, ASP.NET MVC3, C# with an ODBC data connection on Windows Server 2008 R2.
This code runs as expected when using Visual Studio's built-in web server, but fails with a "System.FormatException" when run through IIS7.
OdbcConnection conn = new OdbcConnection("Dsn=MyDSN");
OdbcDataReader reader = null;
string result = "";
try
{
conn.Open();
OdbcCommand cmd = new OdbcCommand("select * from my_table limit 3 offset 10", conn);
cmd.CommandType = CommandType.Text;
DataSet ds = new DataSet();
OdbcDataAdapter da = new OdbcDataAdapter(cmd);
da.Fill(ds); // Fails right here when viewed through IIS7 with a FormatException
.
.
.
... I'm at a total loss. I can accept the possibility of there being something in 开发者_StackOverflowthe returned data that causes this exception, but I'd hope it'd manifest itself in Cassini as well!
Does anyone have any suggestions in how to fix this problem or why there's such a difference of behavior between IIS7 and Visual Studio's built-in webserver?
Thanks!
Solved. This was a 32-bit vs. 64-bit issue. Setting the application pool for the site to run as 32-bit fixed the problem!
Try in compatibility mode in IE. It solved the problem for us.
精彩评论