.NET Web Service Config Questions

S

samadams_2006

Hello,

Given the following snippet of code:

----------------------------------------------------------------------------------------------------------------------------------------------------------------
namespace OurWS
{
[WebService(Namespace="http://aprior.xenor.com/OurApps/OurWS")]
public class DataPublisher : System.Web.Services.WebService
{
OurUtil autil;
private const string gc1_REGISTRY_KEY = "SOFTWARE\\OfficeApps\
\OurWS"; private const string gc1_REG_DB_CONNECTION =
"ConnectionString";
public InfoPublish()
{
InitializeComponent();
autil = new CommonUtils(GetConnectionString());
}

----------------------------------------------------------------------------------------------------------------------------------------------------------------

This is what I have in Source Safe, and I've been asked to make a few
changes. My question two fold:

1) In regards to the line:

[WebService(Namespace="http://aprior.xenor.com/OurApps/OurWS")]

As we move this Web Service from DEV --> QA --> PROD, this namespace
will not necessarily be present on the environment in question. For
example, "http://aprior.xenor.com/OurApps/OurWS" may exist in the PROD
environment, but not in the DEV environment. I have been changing
this to:

[WebService(Namespace="http://localhost/OurApps/OurWS")]

on my local PC as I've been modifying this Web Service, but I don't
want to have to change this and recompile the Web Service as I move it
to DEV, then again on QA, then again on PROD. My questions are:

a) Is there a way to perhaps read this NameSpace from a Config
or XML file, so that when I move this Web Service to DEV --> QA -->
PROD, I will only need to change the entry in the Config or XML file,
and not recompile the whole Web Service?

b) Does this matter what this says? I was told that this is
just a name, and that if you move the Web Service to DEV --> QA -->
PROD, it doesn't matter.

2) My second and final question is, as you can see from the code,
there are two registry key entries:

private const string gc1_REGISTRY_KEY = "SOFTWARE\\OfficeApps\
\OurWS"; private const string gc1_REG_DB_CONNECTION =
"ConnectionString";

The program is currently getting the connection string information
from these registry keys. I would like to get this info from a Config
or XML file instead. What is the best solution to this problem?

Thanks
Sam
 
W

What?

Hello,

Given the following snippet of code:

----------------------------------------------------------------------------------------------------------------------------------------------------------------
namespace OurWS
{
[WebService(Namespace="http://aprior.xenor.com/OurApps/OurWS")]
public class DataPublisher : System.Web.Services.WebService
{
OurUtil autil;
private const string gc1_REGISTRY_KEY = "SOFTWARE\\OfficeApps\
\OurWS"; private const string gc1_REG_DB_CONNECTION =
"ConnectionString";
public InfoPublish()
{
InitializeComponent();
autil = new CommonUtils(GetConnectionString());
}

----------------------------------------------------------------------------------------------------------------------------------------------------------------

This is what I have in Source Safe, and I've been asked to make a few
changes. My question two fold:

1) In regards to the line:

[WebService(Namespace="http://aprior.xenor.com/OurApps/OurWS")]

As we move this Web Service from DEV --> QA --> PROD, this namespace
will not necessarily be present on the environment in question. For
example, "http://aprior.xenor.com/OurApps/OurWS" may exist in the PROD
environment, but not in the DEV environment. I have been changing
this to:

[WebService(Namespace="http://localhost/OurApps/OurWS")]

on my local PC as I've been modifying this Web Service, but I don't
want to have to change this and recompile the Web Service as I move it
to DEV, then again on QA, then again on PROD. My questions are:

a) Is there a way to perhaps read this NameSpace from a Config
or XML file, so that when I move this Web Service to DEV --> QA -->
PROD, I will only need to change the entry in the Config or XML file,
and not recompile the whole Web Service?

You can try it. It's up to you to make that determination if it works.
The program is in your hands, and there is an Web Configuration Manager
namespace for the Web.config to read it.
b) Does this matter what this says? I was told that this is
just a name, and that if you move the Web Service to DEV --> QA -->
PROD, it doesn't matter.

It's a pointer and any client wanting to make contact with the Web
service must know the name of the namespace.

2) My second and final question is, as you can see from the code,
there are two registry key entries:

private const string gc1_REGISTRY_KEY = "SOFTWARE\\OfficeApps\
\OurWS"; private const string gc1_REG_DB_CONNECTION =
"ConnectionString";

The program is currently getting the connection string information
from these registry keys. I would like to get this info from a Config
or XML file instead. What is the best solution to this problem?


You put it in the Web.Config and you use the Web Configuration Manager
to read the value of the Connection string.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top