Showing posts with label adding. Show all posts
Showing posts with label adding. Show all posts

Sunday, March 25, 2012

cant add sql endpoint to my visual studio project. trying "add as web reference" does

i have created a database endpoint that just retuns some data. i am trying to call this endpoint as a web service in visual studio by adding a web reference, but i cannot find my endpoint. it seems to just check iis for endpoints, but how do i make it look for my sql endpoint? here is the code for my endpoint.

create endpoint testEndpoint authorization [FINTAN-PC\Fintan]
state=STARTED
as http
(
path ='/sql',
authentication=(INTEGRATED),
ports = (CLEAR),
site='SERVER'
)
For SOAP
(
webmethod'ProvideSQLData'(name='adventureWorks.dbo.testEndpointProcedure'),
WSDL=DEFAULT,
SCHEMA=STANDARD,
DATABASE='adventureworks',
NAMESPACE='http://thenamespace.org'
);
GO

the account that visual studio is running under has been granted connect permissions on the endpoint. can anyone say where im going wrong here?

I'm a little unclear on your mentioning of using Visual Studio to look for this SOAP endpoint. Are you referring to using UDDI?

Regarding "add as web reference" in Visual Studio, the method that has worked best for me is to type in the HTTP URL that points to the WSDL document.

In this scenario it will be: http://SERVER/sql?wsdl

This URL comes from:

site='SERVER'

path='/sql'

So, if the endpoint was configured with:

site='foobar'

path='/myOwnPath/subPath'

then the WSDL document URL will be http://foobar/myOwnPath/subPath?wsdl

One easy way to ensure the user account running Visual Studio has access to retrieve the WSDL document is to use a Web Browser (such as IE) and point to the WSDL document URL.

HTH,

Jimmy|||ok, tiny bit of progress made. when i use the http://sitename/path?wsdl , rather than getting a 404 error, i get a page cannot be displayed. this is in IE7. any ideas?

cant add sql endpoint to my visual studio project. trying "add as web reference" does

i have created a database endpoint that just retuns some data. i am trying to call this endpoint as a web service in visual studio by adding a web reference, but i cannot find my endpoint. it seems to just check iis for endpoints, but how do i make it look for my sql endpoint? here is the code for my endpoint.

create endpoint testEndpoint authorization [FINTAN-PC\Fintan]
state=STARTED
as http
(
path ='/sql',
authentication=(INTEGRATED),
ports = (CLEAR),
site='SERVER'
)
For SOAP
(
webmethod'ProvideSQLData'(name='adventureWorks.dbo.testEndpointProcedure'),
WSDL=DEFAULT,
SCHEMA=STANDARD,
DATABASE='adventureworks',
NAMESPACE='http://thenamespace.org'
);
GO

the account that visual studio is running under has been granted connect permissions on the endpoint. can anyone say where im going wrong here?

I'm a little unclear on your mentioning of using Visual Studio to look for this SOAP endpoint. Are you referring to using UDDI?

Regarding "add as web reference" in Visual Studio, the method that has worked best for me is to type in the HTTP URL that points to the WSDL document.

In this scenario it will be: http://SERVER/sql?wsdl

This URL comes from:

site='SERVER'

path='/sql'

So, if the endpoint was configured with:

site='foobar'

path='/myOwnPath/subPath'

then the WSDL document URL will be http://foobar/myOwnPath/subPath?wsdl

One easy way to ensure the user account running Visual Studio has access to retrieve the WSDL document is to use a Web Browser (such as IE) and point to the WSDL document URL.

HTH,

Jimmy|||ok, tiny bit of progress made. when i use the http://sitename/path?wsdl , rather than getting a 404 error, i get a page cannot be displayed. this is in IE7. any ideas?

Thursday, March 22, 2012

Can''t add a database with C#

I'm new to SQL Express and I can't even seem to do the simplest thing, adding a database with C# 2005 Express

I watched the tutorial at http://msdn.microsoft.com/vstudio/express/beginner/windows/tier3/begin8

and tried what the author did with C# : Made a new project, right clicked the project then Add->New Item-> SQL Database

After a few seconds I get the error:

An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 2"6 - Error Locating Server/Instance Specified)

I selected "Local and remote connections" in SQL Server 2005 Surface Area Configuration but it still doesn't work.

Any ideas?

This error can be a bit misleading and IIRC I was getting it when I was first poking around in SQL Express a few months ago. With me it was the fact that I wasn't supplying the instance name correctly when connecting to the server. It should be in the form Machinename\InstanceName. Express installs by default as SQLExpress but the people who had set this up for me installed it as SQLSERVEREXP or something like that.

|||Are you sure I even have to enter an instance name? In the video tutorial the author didn't need to do that.
|||

Run sqlcmd.exe -L. It will list the name of your sql server instance to connect to. It will most likely be either 'HOSTNAME' or 'HOSTNAME\SQLEXPRESS'. By default, on the local machine, VS/SSMS use '.' which means 'HOSTNAME'.

|||

Thanks for the replies so far.

I ran sqlcmd.exe -L. It's blank though, it's just "Servers: "

But does this really need to be done though if the database will be on the same machine running Visual C#? Like I said, in the tutorial video the guy didn't even type a line of code. He just added a new "SQL Database" item to his C# project.

If it matters, I haven't done anyting with SQL Express, I just installed it, then installed C# Express and straight away attempted what's being done in the video.

|||

Start the MMC extension services.msc, look to see if sql is running ("SQL Server (?)" - question mark is your instance name (most likely SQLEXPRESS)), and start it if necessary. Then specify HOSTNAME\SQLEXPRESS as the connection string if the question mark is SQLEXPRESS. If the question mark is MSSQLSERVER, use just HOSTNAME.|||I reinstalled everything on a separate computer and it works now. I must have messed up with the initial installation on my original PC.

Thanks for the replies.