Service in Silverlight application does not work when deployed - visual-studio

I've created a Silverlight application that uses a service. The service is defined in the web project in that solution. The silverlight application references it and uses it.
Everything works locally on my dev machine when I run the application in Visual Studio.
I note that the url im given from VS is: http://localhost:50453/Default.htm
But when I deploy this (by filesystem copy deploy option) the web page starts and it looks okey except that it seems to have a problem using the service.
In the Silverlight application, if I look at the reference settings the url to the service is: http://localhost:50453/SilverlightService.svc and thats probably whats wrong, as the server that Im deploying to does not have a clue whats on port 50453.
So Im trying to change this port to 80 on my dev machine but Im out of luck. My web project does not have any property where I can change the port. Opened URL and URL is locked at http://localhost:50453 :-/
How can I change the my dev environment to match the production environment with port 80?

For sure you can change the web project's URL in project properties, but this is not a good solution because you'll get the same problems when accessing the SL application from a remote computer.
You need to set the service URL programmatically, like above:
ServiceReference1.Service1Client svc = new ServiceReference1.Service1Client();
Uri serviceUri = new Uri(System.Windows.Browser.HtmlPage.Document.DocumentUri, "Service1.svc");
svc.Endpoint.Address = new System.ServiceModel.EndpointAddress(serviceUri);
This solution uses the same URL that you are using to access the Silverlight Application.

Related

IIS Express Web API and multiple projects

-My Web API project running in its own project is fine.
-Trying to run my Web API project from within a solution which contains another web project I get the following suggestion given its 'forbidden'
1. Go to the IIS Express install directory.
2. Run appcmd set config /section:system.webServer/directoryBrowse /enabled:true to enable directory browsing at the server level.
3. Run appcmd set config ["SITE_NAME"] /section:system.webServer/directoryBrowse /enabled:true to enable directory browsing at the site level.
The first appcmd suggestion works fine, the second does not. I believe the reason is because my site name does not exist in iis Express until it runs or I am doing something else wrong.
This leads to the last question.
-Can I even have a Web API project running while another web project in the same solution consumes its methods. I assume the answer is no.
In fact I assume that if I want to have a web application consume the methods of this Web API application I am going to have to install a proper IIS stand alone.

Web application is seemingly not running when deployed in websphere

I have a war file which I deployed and ran in tomcat. Then I deployed it in websphere from admin console. The status of the webapplication is seen as started along with the built-in web applications such as "ivtApp", "query", etc. Now from this link:
Heading
http://pic.dhe.ibm.com/infocenter/wasinfo/v6r0/index.jsp?topic=%2Fcom.ibm.websphere.nd.doc%2Finfo%2Fae%2Fae%2Frins_portnumber.html
It looks like the port number for web application is 9080 for http. I tried to run the application using the link:
http://{localhost}:9080/spring3HibernateMaven/index
(I am using "{" because this website didn't allow typing localhost)
the context root being spring3HibernateMaven. And I get page not found error in the browser. So I thought there must be something wrong with my web application. Hence I tried to run their web application:
http://{localhost}:9080/ivtApp
Which gives the same error. Even
http://{localhost}:9080/
gives the same error. I assume it should show something for this url as is shown from tomcat.
So how can I run the/any web application in websphere? FYI, I downloaded the latest version of websphere from their website.
Thanks
ivtApp has context path "ivt", so you need to use host:9080/ivt
Btw, you can find context path setting in websphere\application control panel

Building and starting a web role in Visual Studio with a specific URL

I have an Azure service containing a web role. Both configured to run on IIS Server locally. I would like to build/deploy and start the web role in a specific URL in Visual Studio. It always ends up in addresses using 127.0.0.1 even I specify what project URL is in the project configuration. Is there any way to change this something like dev.xxx.com?
You're running through the local emulator I assume. As such, the URL project settings won't apply. Just like if you deploy it to the cloud, you'll need some type of DNS forwarder or alias.

How can I change the URL of my IIS published web application

This is my first time publishing my visual studio project. I am using IIS manager to publish it. My server name is KIMSERVER and the port I have now is 97. Thus when I need to launch the web app I saved I need to type KIMSERVER:97/
Is there any way that I can change the URL to KIMSERVER/WebApp1 or any URL I want?
Thank you.
Create a new Virtual Directory in your Sites App Pool (Name it WebApp1 and it should be possible to connect via KIMSERVER/WebApp1).
After you published to it, its converted to an application.

How to access web service on port other than 80 in vs2008/2010

I tried searching the net, also tried some workarounds I found (like manually executing wsdl.exe) but still I can't access a remote web service running on a port different than 80 (say 1234).
When from Visual Studio 2008 OR 2010 I add a web reference using a url like http://192.168.1.2:1234/WebServices/Test.asmx, the service is found but when I press Continue, VS is unable to create the proxy classes and gives me an error saying that http://192.168.1.2/WebServices/Test.asmx (notice the missing port) was unable to return anything. Is there something I can do apart from creating the web service localy, creating the proxy classes and then manually changing the url?
Thanks in advance!
You're supposed to set the Url property on the web service proxy class.

Resources