HTTPS website accessing HTTP WCF service - asp.net-mvc

I have deployed an MVC web application on IIS, and it is configured to run over HTTPS.
Further, the website is consuming a WCF service which is deployed on other server (in same network). The WCF service is running over HTTP.
Everything seems working fine, but while accessing the website it is always giving following message on IE 8.
How can we make the site accessible without the below message getting displayed? Also, the solution should not entail any changes at client-level. I need a solution which can be done at site-level.

it seems that you have enabled https and want to consume service vai http. so please change your serviceMetadata
<serviceMetadata httpsGetEnabled="true"/>
to
<serviceMetadata httpGetEnabled="true"/>

If you are calling the WCF service from client script then the error is just warning the user of mixed content mode.
I would suggest you change the binding for the WCF service and call that over ssl. If its important enough for the site to be running over ssl surely this also goes for the wcf service?

Related

mORMot responding to HTTP requests on port 80 instead of IIS

The website of our company is running on IIS 7.5, recently and without any modifications in the configuration, the website start to give us the error 404, here is a picture of the error :
the website work fine with HTTPS and HTTP on every port except the port 80, and we have never used MorMot
Do you have any ideas where this problem comes from ?
There is a registration mechanism for URI on Windows, when using http.sys. It is a kernel/system component, handling HTTP/HTTPS requests.
This registration is shared by IIS and other programs using http.sys, like WCF or mORMot projects.
From the HTML returned, there is clearly a mORMot-powered executable running on the server, which is bound to port 80. You have to identify this program and fix its configuration, to use another port or another sub-URI on port 80, to share it with IIS.
One big benefit of http.sys - in addition to its performance - is that you can share URIs on the same (sub)domain between executables, but you need to register the sub-URI. This is a standard mechanism under Windows - please check this reference page for instance.
Another possibility may be to use IIS as reverse proxy, and run the mORMot-powered executable on a local non-routed port, if you have troubles with http.sys configuration (which is not easy).

Consume Secured web service in Asp.Net MVC

I'm working on asp.net mvc
I want to consume secured web service in my project
In previous I can consume unsecured web service (asmx) by calling wsdl to create proxy class ,now
I tried to create proxy class for the service by using wsdl.exe by using the following formula
Wsdl /language:language /protocol:protocol /namespace:myNameSpace /out:filename /username:username /password:password /domain:domain
But I had the following error
Error: There was an error processing 'https:// .asmx?wsdl'.
- There was an error downloading 'https:// .asmx?wsdl'
- Unable to connect to the remote server
- A socket operation was attempted to an unreachable network ??.???.???.??:???
Can you tell me how can I consume secured web service in my project
Yara
I dont know what sort of service you are talking about but I suspect you are Adding it as a Service/Web reference. If thats the case then assuming its called WebService1 and that the security you are talking about it basic authentication then:
WebService1 svc = new WebService1();
svc.AuthenticationHeaderValue = new WebService1.AuthenticationHeader();
svc.AuthenticationHeaderValue.UserName = "username";
svc.AuthenticationHeaderValue.Password = "password";
Try that. As I said I dont have much info on what you are trying to do so its a guess.
First of all it doesn't matter you are in MVC or any other technology.
If you can call https webservice using simple code, it will do wonders for you.
So first try calling simple HTTPS web service, google and play around it.
For learning purpose and to gain more knowledge, check these links
How to call HTTPS web service method from a .net console application?
Calling a https web service (C#)
http://support.microsoft.com/kb/901183

How to publish and host a MVC4 application in your domain?

I have a webdomain www.MyDomain.com and a MVC4 web application MyMVCWebApp.
First I publish the application to a local destination.
For instance: C:\TempLocation
And then I host it to my domain with a FTP-tool (FileZilla??)
The files will be hosted but I can't find the webpage.
Which url do I have to write?
http://www.MyDomain.com/MyMVCWebApp/Home/Index.chtml or something?!
Do I have change the settings in my web.config?
What do I have to do?
You can't host an application on a domain.
An application is hosted on a web server. A domain name is only a way to translate an easy to remember address like "www.google.com" to the web server ip address which looks like 173.194.66.104
It is possible to purchase a domain without a web server.
So before going further:
Check if you actually bought a domain only, or a domain with a server
Your domain should redirect to your server ip address, you can see if he is correctly configured by opening a command prompt and doing
C:\> ping www.yourdomain.com
If this is not the case you will need to update the A record of your domain, and wait for the update to be replicated on DNS server worldwird.
If you have a managed server, you should check your hosting provider website. They usually provide in depth documentation, and they all have a different way to do things. Most of the time indeed you will be able to upload your files using a FTP software such as Filezilla.
However, in order to host a MVC 4 application you need a server with
the IIS web server, which means that you need a Windows server. So if
you have a Linux server, you should contact your hosting provider
support and tell them you made a mistake during your order. (It is
possible to host a MVC 4 application on Linux, but I don't think it
is often provided on managed servers)
If you have a dedicated server you are on your own.
The URL you will have to write to access your application will depends on what you have configured in the RegisterRoutes method of the RouteConfigs.cs file.
I recommend you to watch the last video on this page to have a better overview of the possibilities.

Is there any extra configuration for hosting MVC4 Web Api applications on loadbalancer?

We got Mvc4 Web application on server1 calling our Restfull Mvc4 Web Apis on server2 both hosted on IIS 7.5. This architechture works fine. When we put each application on loadbalanced servers the web application works fine however web api project doesnt run on the second server on the loadbalancer. We have just cloned the environments so they both have identical code and configuration but the servernames and mappings.
Is there any extra configuration for hosting MVC4 Web Api applications on loadbalancer?
has anybody actualy got MVC4 Web Api working on loadbalanced environment?
thanks,
Is there any extra configuration for hosting MVC4 Web Api applications on loadbalancer?
Not necessary if your Web API is stateless and you are not using any ASP.NET session. If you are using an ASP.NET session you might need to use an out-of-process session state instead of the default in-memory.
Has anybody actualy got MVC4 Web Api working on loadbalanced environment?
Yes, I have.
I have found the problem! The damn problem was our firewall blocking the web request

Using ASP.Net MVC & node.js together

I am writing a ASP.Net MVC app that connects to a SQL database and uses existing C# libraries I have.
I also have a TCP server Windows application that sends/receives TCP messages via XML. I have successfully setup node.js and socket.io to handle all this and have a html page that sends/receives messages to the server. Node.js is serving up the html page at the moment. The XML is converted to JSON when sending/receiving data.
I am planning on setting my MVC app to serve the page up but was just wondering what your thoughts are on this use of cross framework setup. Does it seem viable and a good solution for handling TCP messages and sending it to the browser? I have also read about iisnode for hosting node in IIS which I guess would be a good idea for my setup. What are your thoughts on this?
You basically have two websites. One is your ASP.NET MVC website. and the other is a web client for your TCP windows application.
Since they are disjoint it will work fine.
You may want to have that web client's html server through ASP.NET MVC and only run a websocket server on node.js though. You may need to do some proxying to get the same origin to work.
If you server your HTML page from a webserver running IP Y, port X and then try to talk to the node.js websocket server running on IP Y, port X + n it may violate the same origin restriction.
This means your basically loading a socket.io client from server A and trying to talk to server B. The web page doesn't know you own both of these servers.
The solution would be a proxy, you proxy all requests to server A and B but since they all go through the proxy it doesnt violate the same origin.
As for proxy, nginx is one. There is a node-proxy. And IIS might be able to proxy it for you (Although I doubt IIS makes a good proxy)

Resources