how to access webservice from one project to another project - asp.net

i have an project with name called(dbservice layer) which is in path: d:\webservice\DBService. here i have an webservice which connects to DB and returns an object of an class.
once i added an reference here i get an url:http://localhost:2371/Jobs.svc
now i have another project name (UILayer) whic is in path: E:\School\UILayer
i added an service reference here with url as http://localhost:2371/Jobs.svc
but i get an messgae telling service is unable why is that happening.
if both my webserivce layer and ui layer are in same project. then i able to use the webserive in the ui layer. and get the required output
so i wanted to know is there any way we can acesss the webserive from one project to another project
thanks in advance
prince

Publish your web service to an actual location and then add a reference using the actual URL not the one served up by visual studio. What I think is happening is each Visual Studio instance is using a different port so you can't say localhost:2371 for both projects because that is the local port for the instance your running with your original project.
Publish it and then access it via http://localhost/jobs.svc. You should be able to access it via IE directly without running Visual Studio if you have published it correctly.
The main point is, you have the wrong URL.

Related

How do I navigate to my Visual Studio's App_Data folder in relative way

I have an ASP.NET Web Api project which has App_Data folder. Inside of it I have a database file(.sqlite) which I use in my application. There's a connection string to it that resides in my configuration files. The path is absolute and includes my current file structure(C:\Something\Other\App_Data\MyDb.sqlite). The problem is that I want to host it on Azure and most likely Azure won't find this path. So, for that purpose I would like to use a relative path so on Azure the file gets properly located.
Within your server side code (C#, VB.NET, etc.) you can use: ~/App_Data/.
If you are trying to reach the directory within a connection string you can use: Data Source=|DataDirectory|DatabaseName.sdf
If you want to use Azure web app with single instance, please try the connection string that Jesse Johnson provided. If your web app need scale across multiple machines, I think SqlLite is not suitable for you to use. Azure Web App ARR will dispatch the request to some instance, and your data will saved to this instance via SqlLite. If next time the request is dispatched to another instance, I think you could not read the data you saved before. I think it is better to choose Azure Storage or Azure SQL to save your data.

Running ASP.Net server - Must be from visual studio?

I'm pretty new to ASP.Net and I've been having troubles understanding something.
I made a web application project with a web service on my computer.
I made another web application project, who then consumed the WSDL from the web service on the first project and uses a function in it.
I ran each on a different VS2012 Instance and when both projects are running in then there is no problem and it works fine.
When i close the VS Instance with the Web Service project then I get a Coonnection Error which is also logical.
My question:
Is there a way to keep the server running without keeping visual studio open?
There is no ".exe" generated or anything so I don't know what to run in order to keep the "Server" running..
Additional question if you don't mind:
If I want to use this service from another computer on the same Network, will the "localhost:.....?WSDL" service reference still work or do I need another address?
Sorry for my lack of knowledge, I just couldn't find a good guide explaining about how to keep the server running anywhere.
Thank you, Mellor.
Host your web service in localhost
use the computername instead of localhost in WSDL URL when you add services/web reference in cleint applications

Adding web service reference to ASP.NET Website?

I want to add a service reference to a wsdl web service in my ASP.NET website. In Visual Studio I right clicked the project and then Add service reference. It then created the *App_WebReferences* folder with some files in it and it added some new things to my web.config.
After I moved the changes to my test server by copying the new file, the App_WebReferences folder and the changed web.config, the server tells me that I'm missing a reference for the web service. I thought it should be in either web.config or that ASP.NET should find it in the App_WebReferences folder.
I've missed something obvious but I can't figure out what. What have I missed and what do I do to get my web service reference to work on my test server?
It's working really well on my local machine.
Was this working fine locally? You need to make sure you import the service to any classes that may be using it (or Using if you are doing this in C#). Also, is the service you imported from a project that is on your pc? IF so, you will need publish that as well to the test server.

Problem Importing Web Service

I have created a web service in a virtual directory using VS 2008. I have tested the service by going to the .asmx page and everything is working fine. So I selected the "Add web reference" option under the solution and typed in the .asmx URL. It found the web service successfully and added the reference to the project. However, when I try to import the service namespace using the same name as the directory under the "App_WebReferences" folder, it doesn't recognize the name and gives me an error if I try to import it. Have I missed any steps in the process?
Update: Try generating the proxy manually using the wsdl tool and adding the proxy class as an existing item to client web application project as mentioned in the link.
Something strange happening with proxy generation in your case from VS. Maybe an access issue.
If it happened fine, you should be able to find the VS generated proxy class under one of the sub-folders of
%windir%\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\ (for Asp.Net 2.0). Search for file names starting with App_WebReferences*.cs in the temporary folder.
When you added the web service, what is the name of the web reference you gave? Use the same web reference name in your import statement.
In this link, web reference name is com.deepfitness so you can import com.deepfitness namespace in your asp.net app.
To be absolutely certain click view all files in you web project and follow your reference in App_WebReferences down until you get to reference.cs open this and you can see the correct namespace.

How do I get the build to automatically update a web service reference in Flex?

From within FlexBuilder3, I can go to "Data/Manage Web Services..." select a web service, and click "Update" to ensure that my code and the server are in sync. How do I automate this so that each time I build, the automatically generated web service code is regenerated?
If the server interface changes during development but my code doesn't, it won't work anyway - I'd rather have a compilation error than a runtime error I had to track down to a changed web service interface.
Unfortunately you can not update a web service at build time. The update is part of the wizard and is not implemented as a separate action to be called on demand.
One suggestion I have is to go in the project properties and inside the Build panel add as a new builder a program. You will have to create this program that checks each time the project is build that the WSDL file did not change. It is a little bit complicated but if you are working on a project that relies on a web service that is under heavy development it might save you a lot of time.

Resources