Thread: Windows 2008/IIS cannot connect to Postgres 9.0

Windows 2008/IIS cannot connect to Postgres 9.0

From
Mike Christensen
Date:
Hey I know most of you guys are huge Windows fans, and UNIX support
will eventually be dropped in Postgres cuz really who uses that, but I
figure someone in here would love to help me with a Windows issue that
has me confused.

Postgres is working awesome on my Windows 2003 development
environment, using whatever flavor of IIS that thing comes with (is it
IIS6?)..  However, I'm in the process of moving my site over to
production cloud servers and these appear to be rain clouds, as I'm
having all sorts of issues getting this running..  When I setup the
site with Windows 2008/IIS, the first page that queries Postgres gives
me the following crash:


   3005
   An unhandled exception has occurred.
   10/5/2010 7:18:04 AM
   10/5/2010 7:18:04 AM
   fd49ed9391dd46fe9d2d11bd6392d9b6
   6
   1
   0
   /LM/W3SVC/1/ROOT-1-129307366626956000
   Full
   /
   C:\inetpub\wwwroot\


   2796
   w3wp.exe
   IIS APPPOOL\DefaultAppPool
   InvalidOperationException
   The Connection is not open.
   http://127.0.0.1/logon.html
   /logon.html
   127.0.0.1

   False

   IIS APPPOOL\DefaultAppPool
   7
   IIS APPPOOL\DefaultAppPool
   False
   at Npgsql.NpgsqlCommand.CheckConnectionState() at
Npgsql.NpgsqlCommand.GetReader(CommandBehavior cb) at
Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior cb) at
Npgsql.NpgsqlCommand.ExecuteDbDataReader(CommandBehavior behavior) at
System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader() at
KPCServer.DB.Query.ExecSproc(String sproc, DbParameter[] parameters)
at KPCServer.KitchenPC.GetFeaturedRecipes(Int32 max) at
KPCServer.Pages.Logon.FeatuerdRecipes(TextWriter output,
DynamicContentArgs args) at Imp.Compiler.CompiledPage.Render(BasePage
page, TextWriter output) at
System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step,
Boolean& completedSynchronously)


I couldn't find anything on the Googletubes about this, so after like
half an hour of cursing, I finally ran across a setting that fixes it.
 If I switch the "Managed Pipeline" setting (WTF does this even mean?)
from "Integrated" to "Classic", everything works.  My question is
what's the deal with this?  Does "Integrated" somehow block the
process from opening a connection with Postgres?  In the Postgres logs
I couldn't even see any evidence that anything was trying to connect
with it..  If anyone has an IIS7 website connecting to Postgres, maybe
you can share your app pool settings with me so I can understand the
best practice, as this will be a production environment now..  Thanks,
and sorry again for the quasi-off-topic email..  Go Postgres!

Mike

Re: Windows 2008/IIS cannot connect to Postgres 9.0

From
Craig Ringer
Date:
On 05/10/10 16:08, Mike Christensen wrote:

>    at Npgsql.NpgsqlCommand.CheckConnectionState() at
> Npgsql.NpgsqlCommand.GetReader(CommandBehavior cb) at

It looks like nobody reading -GENERAL really speaks npgsql/.NET/C#.
Perhaps you should try on the npgsql list instead?

Try filing a bug/support request here:

http://pgfoundry.org/projects/npgsql/

or posting in the forums linked to off that page. It looks like the
npgsql folks primarily use forums and the tracker for user support.

Sorry I can't help you further, but I don't do .NET. I wouldn't mind
learning, but access to the various "technologies" is cripplingly
expensive or (for the express editions) painfully and cripplingly limited.

That's partly the reason for the relative antipathy toward the Windows
platform that you have sarcastically observed. It's just no fun to work
on as a solo, independent developer, because everything that's not
$omfgwtf is crippleware. For example, Microsoft have removed the ability
to attach a debugger to an already-running process from MSVC++ Express
2010. 2008 used to support it. Since neither can open crash dump files
or be installed as a post-mortem debugger either, you get to have fun
with windbg. With things like that, it's little surprise that many
people here loathe working with and supporting Windows platforms, when
the tools are deliberately crippled for anyone not working under a
moneyed-up corporate umbrella. Microsoft isn't handing MSDN
subscriptions out to Pg users/contributors/developers, unsurprisingly,
so it's necessary to drop a pile of personal money on MS dev tools or go
lacking. Most go lacking, and find getting involved in Windows-based
development pretty unappealing as a consequence.

I actually like MSVC++'s debugger a lot, for what it's worth. It's just
annoying that Microsoft only recognises two classes of user - "student"
and "corporate employee with MSDN". Independent/open source developers
do not exist on their radar and do not deserve access to decent tools.

--
Craig Ringer

Tech-related writing: http://soapyfrogs.blogspot.com/

Re: Windows 2008/IIS cannot connect to Postgres 9.0

From
"Francisco Figueiredo Jr."
Date:
On Thu, Oct 7, 2010 at 00:00, Craig Ringer <craig@postnewspapers.com.au> wrote:
> On 05/10/10 16:08, Mike Christensen wrote:
>
>>    at Npgsql.NpgsqlCommand.CheckConnectionState() at
>> Npgsql.NpgsqlCommand.GetReader(CommandBehavior cb) at
>
> It looks like nobody reading -GENERAL really speaks npgsql/.NET/C#.
> Perhaps you should try on the npgsql list instead?
>

I do. Although I sometimes take more time than normal to answer...
Sorry for that.

Well, the error you are getting is really because Npgsql isn't being
able to connect to your postgresql server.

I also have no idea about what Managed Pipeline means but I'm glad you
get it working.

Would you mind to share how did you set it up so we can share that
with other Postgresql/Npgsql users?



> Try filing a bug/support request here:
>
> http://pgfoundry.org/projects/npgsql/
>
> or posting in the forums linked to off that page. It looks like the
> npgsql folks primarily use forums and the tracker for user support.
>

Yeap. That's our primary support way.

But I also keep eye on general, dev and interfaces mailing list in
case something about Npgsql appears.



--
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://www.npgsql.org
http://fxjr.blogspot.com
http://twitter.com/franciscojunior