Is this the way I should deploy a asp.net application - asp.net

I have a solution containing
asp.net project
class library
WCF service class library
WCF service application
I've added a project refference from the asp.net project to the class library project and to the service class library project.
I've published the asp.net application, loaded it to the webserver root. all ok.
Now for the service, I've created a new folder on the root called WCF, and placed the aplication in there.
Is this The way I should deploy the sollution? Are this the steps when you have more than a simple asp.net application?
PS: How do I change that WCF folder to make it an application trough a control panel because I get this:http://surveillancecamera.somee.com/WCF. The reason why I get this is described here:

I would treat the WCF service as a separate entity altogether. Deploy the WCF service and verify it works, then deploy the ASP.Net application.
WCF services have a different set of configuration rules that don't always pair nicely in the same "application root" as your ASP.Net web application. In addition, you may want to use the same WCF service in different applications, and it may not be accessible if it is tightly coupled to this ASP.Net application.

Related

How can I share a simple string value (config) between two web applications asp.net and asp.net core in IIS?

How can I share a simple string value (config) between two web applications asp.net and asp.net core in IIS?
I don't want to use cookies
In my opinion, we could achieve this in the following ways,
Web service, such as WCF.
One application is used to create and host WCF service. Another application is used to consume the service.
Create and host the service in a web application by using the default WCF project template in Visual Studio or directly adding an SVC file to the current web project.
https://learn.microsoft.com/en-us/dotnet/framework/wcf/feature-details/how-to-host-a-wcf-service-in-iis
https://www.c-sharpcorner.com/UploadFile/4d56e1/how-to-create-and-consume-wcf-services/
Consume the service.
https://learn.microsoft.com/en-us/dotnet/core/additional-tools/wcf-web-service-reference-guide
Shared sessions stored in the same database.
Passing session data between ASP.NET web applications
Sharing sessions across applications using the ASP.NET Session State Service
Feel free to let me know if there is anything I can help with.

Can't access Newly Added WCF Methods in Web Application

I am developing an Web application using WCF. I have added Web Reference in Web Application. I am adding methods in WCF as per my need then updating Web Reference in Web Application and it is updating successfully but can't access the newly added methods of WCF in Web Application.
Please Help me...
Do your new methods exist in the contract interface, and do they have the OperationContract attribute?
When you update the web reference, is it looking at a test service or your newly-modified service?
Are you running the modified service when you update the web reference, or is it that the old version of the service is running under an ASP.NET process (check your taskbar) and that is what you are updating from?
Have you rebuilt the client after updating the web reference (I know, I know, but easily missed)?
Yes I did it.
I just deleted Web Reference from Web Application and then cleaned the solution of WCF and Web Application. After that Build Solution of WCF. Then added WCF Reference through "Add Service Refeence" then Build Solution of Web Application. In this way solved my problem.

How to add wcf functionality to an existing asp.net website project

I have several asp.net website projects for various sites.
Currently I want to add REST API's to these projects so I can start developing mobile apps (using HTML5/JavaScript/CSS3 and PhoneGap) that make use of these webservices.
Since WCF is far more powerful than regular asp.net webservices (among others with control over the service and authentication/authorization), I'd love to add these to my existing website project.
I did a Google search but cant find anywhere a step-by-step tutorial how this can be done. And also if there's any functionality I'd possibly loose when adding WCF functionality
I was also thinking of creating a new project specifically for WCF, but think I'd rather add it to an existing website project.
Can anyone help me with this?
Depending on exactly what your needs are and how your current web site is configured, there are two approaches.
If you are using a Web Site Project, then you should create your WCF service in a different application:
1) Create a new ASP.Net Web Application Project.
2) Add a new item to the project and select the type of WCF Service or WCF Data Service.
When you deploy this project, you will deploy it to your web server, but not as part of your web site since configuring the web.config will be a large manual effort.
If you are using a Web Application Project, then you could add the WCF Service directly to your existing project. However, I only recommend this approach if you are Silverlight applets within the web site that rely on the user's authenticated credentials.
WCF can be configured with a lot of bindings and it can be configured to return xml or json(.net 4.0). Try to create a wcf service configured to use basichttpbinding or wsHttpBinding and to format the response as json and use jquery to interact with the wcf service. This article might help you http://www.codeproject.com/KB/aspnet/Cross_Domain_Call.aspx

WCF using it's own web.config

I have a MVC3 app that is calling a WCF Service Application. The WCF Service App has its own web.config file (comes when you create the project automatically). In this .config I added an appSetting section with key to retrieve.
When I run the MVC app and it calls the WCF svc and the svc cannot see this appsettings value. If I move the appSettings section over to the MVC web.config the service application sees the value.
I would expect this from a calling application if it were a Winform or client based application calling a DLL but not where I have 2 separate apps where I actually want separate configuration files.
For example, I want to configure unity in my web services to perform dependency injection. I don't want the calling web application to know or have to define these values. The service should have them.
The issue I had was with the Unity configuration in the MVC app. Originally I had been pointing at a class library for my services layer, I swapped this over to use WCF. When I did this I left in the old type registrations which unity resolved and caused it to look at the new WCF project (same namespaces/class names) as a class library instead of using the endpoints that I registered.
Ripped out those specific class registrations leaving just the interfaces and endpoints and it worked like a charm.

How to reference web service with my asp.net application

I have my own web service application with more then one .asmx file.
Now i am not getting how can i reference web service with my web application as "Add Web Reference".
I want to connect with both asmx files at once.
Means once i connect web service as add web reference and i can call both .asmx file from my code behind page.
Doesn't work that way. You have to reference each web service or consolidate them.
You could do this:
Invoking Web Service dynamically using HttpWebRequest
When you add a web reference to your application, Visual Studio creates a proxy class that you use to connect to the web service. You will not connect to the web service directly. The proxy class name is set when you add the reference. It suggests a name for you that you can change.
As long as you are using the proxy classes that are generated, you should be able to connect to as many web services as you desire.
I hope that helps.

Resources