Getting error in Tridion while accessing core services - tridion

Could not find endpoint element with name 'wsHttp' and contract 'Tridion.ContentManager.CoreService.Client.ISessionAwareCoreService' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this name could be found in the client element
while accessing:
ISessionAwareCoreService client = new ChannelFactory("wsHttp").CreateChannel();

When you write software using the Tridion core service, you need to do one of two things:
Create a configuration file for your application that contains the correct WCF configuration
Set up the WCF settings in your software by writing code.
If you are creating a config file, then you can start by copying the default one provided by Tridion. On my system this is at C:\Program Files (x86)\Tridion\bin\client\Tridion.ContentManager.CoreService.Client.dll.config
If your core service client is running on the Tridion server itself, that will probably be sufficient. If you are "off the box" then you'll need to edit it appropriately.
If you want to set things up from code, a good place to start is this recipe in the Tridion Cookbook. (There's also a recipe for the non-code approach.)

Related

Where is my app.config file?

I have built a server api that consists aith 3 projects:
Api(an api project) that calles BL(class library) that calls Dal(class library).
Very standard.
It works perfectly locally.
Now when I publish it, the app.config of the BL disappears.
Why is it? Where can I store my configurable parameters?
Thank you very much. Tal
On your main project ASP.NET, use the Web.Config instead of App.Config to make it work.
app.config is only the name during development, once the project is built the app.config is copied to .config and this is what is used by the application when running
An asp.net application reads config from web.config so if you have an app.config it implies that your project is not a web project but a standard library or executable.
if it is a library (.dll) then you should place your config in the web.config (if the library is used by asp.net) or in the .config if its a standard executable.
Ideally your libraries should not read settings as this creates a hidden coupling between the library and config files, and it would be better to provide those configuration parameters to the classes that need them in the library externally, this then leaves the application using the library free to store them where ever is most appropriate.
How is the consumer of your library going to know that they need to add SettingX to the appsettings of their configuration file? Better for the library to require the setting value directly. So if your DAL needs a connection string then the class which wants a connection string should ask for it in their constructor. Then the application using it can get it from settings (or whereever) and pass it to the library., and the consumers have visibility of the dependency on the connection string. If the library reads it from config the consumer has no way to know that this is something they need add to the settings
So in a web app the startup would read the settings from web.config and pass them to your library but some other app using the same library could store them in a database if they wanted.

What is the ModuleRefCollection for in a BizTalk bindings file?

What is the ModuleRefCollection, and child ModuleRef, Services and TrackedSchema for in a BizTalk binding file?
ModuleRefCollection is the container for the Schemas (TrackedSchemas) and Orchestrations (Services) associated with the Application. A Module being an Assembly for Orchestrations and the special Application ModuleRef for TrackedSchemas.
Note, TrackedSchemas is a slight misnomer. It contains the configuration for all Deployed Schemas, not just tracked Schemas.
Each element contains all the binding information, what you configure in BizTalk Administrator, for it's respective artifact.
So, a Schema element will list all the Properties you have checked on it's Tracking Tab.
A Service element will have all of the Port and Host Bindings for that Orchestration.
It's pretty easy to interpret yourself. Take any Application you have that has one or more Orchestrations and export the Bindings. You'll see everything you've configured in BT Admin reflected there.

Does the web application project deployment package has web.config file un encrypted

Does the web application project deployment package has web.config file un encrypted.
What is the use of Package. why they say that in web application project only 1 dll is deployed however web.config file is still residing with connection string un encrypted
Your question was not clear from the beginning. Dave answered correctly. The web.config is indeed unencrypted by default, regardless of the project type you use. You could encrypt it using the instructions given in this post or this post which explains how to encrypt and decrypt configuration sections.
Answering to "what is the difference between a web application project over a website project", this MSDN post describes thoroughly the differences between the two project types, including a summary.
I would suggest using a web application project. The most important benefits (in my opinion) when using a web application project are:
Building produces a dll. This means that when you publish your application, there is no source code on the server. Be careful: This does not mean that your published code is encrypted. Anybody who has access on the server could see your code using a disassembler (like MSIL Disassembler). If you want to make reverse engineering harder, you could use an obfurscator like confuser.
You make debugging easier as the project file contains references to other projects etc. You can also edit and continue while debugging.
You have more visual studio options available, regarding build/publish process. You could for example add prebuild/postbuild steps, using MSBuild or Team Build.
Hope I helped.
web.config file is unencrypted by default, but you can encrypt sections of it if needed. See http://msdn.microsoft.com/library/dtkwfdky.aspx for more info.

Enterprise Library Class Library App.Config

I have a class library whcih is a Wrapper class for Enterprise Library Logging Application Block. There I kept an App.Config configuration file. Where all the Enterprise Library related configurations are present.
Now I refered this Class Library in a ASP.NET Web Application. Problem I am getting is: The ASP.NET Web Application is unable to read the App.Config file to fetch Configuration Information. And I am getting below Exception:
Config files are per appdomain, not per binary. If you've got an .exe, it'll looking .config, in a web app, it looks in web.config. There are some tricks you can use, but they all involved putting something in the main config file - you can't avoid it for the most part.
The easiest thing to do would be to put the information in the web.config file. There are some other options, but they get increasingly more complicated. What version of Entlib are you using? If using 5.0, there's the programmatic configuration support (the configuration builder stuff) that makes is reasonably easy to set up entlib settings through code - you could use those in your library if the configuration is actually fixed.
Although you mention you're wrapping the logging block, but the screenshot shows the exception block. Is your main app going to be using Entlib as well, or just through your wrappers?

ASP.NET solution with class library project

I have an solution in VS 2008 which contains two class library projects and an ASP.NET web site. The ASP.NET site references the class libraries and one of the libraries contains a LINQ To SQL item.
My question is with regards to the app.config in the class library which contains the connection string for the database. When I build the project, this app.config isn't within the build directory and this means I can't dynamically change the connection string for the deployed project.
What am I doing wrong here, how can I have these settings deployed too so I can make changes to the connection string?
Thanks in advance,
Martin.
This caused me a bit of confusion at first as well.
You might think that the class library uses the app.config file that's contained in it's own project but it doesn't. It uses the config file of the project that is referencing it.
So what you need to do is look for the <appSettings/> tag inside the web.config file of your ASP.Net project and change it to <appSettings></appSettings> And add the <add ... /> tags that are contained in the app.config file of the library project. You don't need to change anything in your code for the ConfigurationManager class to figure this out. It knows where to look automagically.
Hope that makes sense.
You can edit the Web.config file in the final product. Configuration APIs normally will get configuration data from the primary configuration file of the application which, in case of ASP.NET apps is the Web.config and for client applications is Myfile.exe.config. It's important to know that class libraries in the project usually will not have their separate configuration file like MyClassLib.dll.config (unless you manually refer to the specific file).
To overcome the problem of connection string, here is the trick
Inside ur class library declare module that has got two properties, one is a setter and the other is a getter, and make them public.
Inside ur website project, go to the global file, and under both session start and application start call the setter property that u declared previously, and assign it the connection string that is located in ur web.config, now the connection string will be available in the website general scope and the value exists as long as ur session credential not expired.
Copy the connectionString section from your library's app.config file to your web.config file. Change the actual connection string from your development to your production server as necessary. The ConfigurationManager class that LINQ2SQL uses to obtain the connection string will look in the web.config file for the appropriately named connection string and use it if it exists.
If you want to have different settings for development vs production, use the Web Deployment Project. Download here. From Microsoft's description:
Visual Studio 2008 Web Deployment
Projects provide additional
functionality to build and deploy Web
sites and Web applications in Visual
Studio 2008. This add-in provides a
comprehensive UI to manage build
configurations, merging, and using
pre-build and post-build tasks with
MSBuild.

Resources