How To Use The Webservice Attribute System.ComponentModel.ToolboxItem(false)
Mar 22, 2011When should we add this attribute to an asp.net webservice ?
[System.ComponentModel.ToolboxItem(false)]
When should we add this attribute to an asp.net webservice ?
[System.ComponentModel.ToolboxItem(false)]
This part of code works fine
[Association(Storage = "profile", ThisKey = "UserId", OtherKey = "UserId")]
public Profile User {
get { return this.profile.Entity; }
set { this.profile.Entity = value; }
}
but if i add in this class System.ComponentModel.DataAnnotations then, Association could not be found.
In my web application i am using video conversion, i am getting error like System.ComponentModel.Win32Exception: Access is denied video conversion is working fine in localserver. when i upload in online it is giving error. error like.. Access is denied Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: ystem.ComponentModel.Win32Exception: Access is denied Source Error:
Line 76: ffmpeg.StartInfo.Arguments = " -i "" + video + "" -vframes 1 -ss 00:00:10 -s 150x150 -f image2 -vcodec mjpeg "" + thumb + """; // arguments !
Line 77: ffmpeg.StartInfo.FileName = Page.MapPath("FFMPEGffmpeg.exe"); //Page.MapPath("UserTrailorvideosffmpeg.exe"); //Page.MapPath(".") + "/ffmpeg.exe";
Line 78: ffmpeg.Start(); // start !
I have one web.config in my website.Suppose i have a setting attribute as Righttoleft=false; in web.config file.I have a BasePage.cs all pages are derived from it.I am setting this Righttoleft=false; or true; programatically in Basepage.cs based on some condition and save it to web.config.I have a dropdown and based on the items selected from dropdown, for some items my web.config file saves with Righttoleft=false; and for some it saves with Righttoleft=true;
View 2 RepliesWe have a C# Web Service that declares itself using attributes. The code-behind file looks like:
[WebService(Namespace = "http://the.web.service.url/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public sealed class TheWebservice : WebService
{
[WebMethod]
public SomeObject TheFunction()
...
The web services has worked for a long time now. Recently, one request resulted in an error:
The maximum string content length quota (8192) has been exceeded while reading XML data. After searching around, I found that there is a setting maxStringContentLength that can increase the meaximum size. The post says you can configure this setting in Web.config in the BasicHttpBinding section. You can then specify that BasicHttpBinding in an endpoint section. But since we declare the webservice using the WebService attribute in the code-behind file, we do not have an endpoint section.
Is there a way to specify an endpoint using a declarative attribute? Alternatively, is it possible to switch from attribute to web.config mode without breaking existing clients? Am I confusing WCF and its predecessor here?
I'm getting started with Astoria/ADO.NET Data Services/WCF Data Services. Looking through a lot of the code samples out there, it appears that the MimeType attribute used to be a method level attribute. After installing the latest update, it is now a class level attribute.
If I have more than one Service Operation that I want to return as a certain MimeType, then it appears now that I have to create a new service for each operation. Is this correct?
Most examples are like this:
[WebGet]
[SingleResult]
[MimeType("application/pdf")]
public IQueryable<byte[]> FooPDF()
{
var result = from p in this.CurrentDataSource.MyPDFs
where p.FooID == 2
select p;
return result.Take(1).Select(p => p.PDF);
}
I get "Attribute 'MimeType' is not valid on this declaration type. It is only valid on 'class' declarations." when I compile, because now I can't do this.
Now, I have to do this:
[MimeType("FooPDF", "application/pdf")]
public class FooService : DataService<FooDBEntities>
{
public static void InitializeService(DataServiceConfiguration config)
{
config.SetServiceOperationAccessRule("FooPDF", ServiceOperationRights.All);
}
[WebGet]
[SingleResult]
public IQueryable<byte[]> FooPDF()
{
var result = from p in this.CurrentDataSource.MyPDFs
where p.FooID == 2
select p;
return result.Take(1).Select(p => p.PDF);
}
}
What's worse is that I can't add duplicate MimeType attributes to my class.
I am load testing my webservice
and get a
System.ServiceModel.CommunicationException
when I use 10 threads to communicate to it (without any sleep in between) - basically testing 10 conenctions at a time - through a windows application
An error occurred while receiving the HTTP response to http://localhost/XXX/XXXService.asmx. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details.Why would this happen and how to best resolve it Also is this the way how asp.net application will interact with it too - is threading the best way to do the load testing
Here is how my 2 projects are
I have a class library project which consumes multiple webservices. I have created a test project in VSTS and try to call one of those service
But I'm receiving System.ServiceModel.EndpointNotFoundException. In my Test Project I have added one app.config file and added endpoint as available in my Serviceclass library project app.config.
I can have a base class for views in an MVC project like this:
public class BaseViewPage : System.Web.Mvc.ViewPage
{
public string Something { get; set; }
}
And then in the ASPX I can do this:
<%@ Page Something="foo" Language="C#" Inherits="MyNamespace.BaseViewPage" %>
This works fine; the problem is when I try to do the same with the generic version:
public class BaseViewPage<TModel> : System.Web.Mvc.ViewPage<TModel> where TModel : class
{
public string Something { get; set; }
}
When I try to use this from the ASPX, like this:
<%@ Page Something="foo" Language="C#" Inherits="MyNamespace.BaseViewPage<SomeClass>" %>
I get the error message:
Error parsing attribute 'something': Type 'System.Web.Mvc.ViewPage' does not have a public property named 'something'.
Notice how it tries to use System.Web.Mvc.ViewPage rather than my BaseViewPage class. To make it more interesting, if I remove the "Something" attribute from the Page directive and put some code in the generic version of BaseViewPage (OnInit for example) the class is actually called / used / instantiated.
So, am I doing something wrong or is this a limitation.
<asp:GridView ID="GridView1" runat="server">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:TextBox ID="TextBox1" onchange="calculate()" runat="server" Text="0"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
I'm getting this error on the above markup: Message 1 Validation (ASP.Net): Attribute 'onchange' is not a valid attribute of element 'TextBox'.
I have a problem with my web site 1stSigBdeAssn.org. I have made no changes to the site but I now get the following error message:
Parser Error Message:
Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive.
Source Error:
[code]....
I created a simple Master Page in Visual Studio 2008:
<%@
Master
Language="VB"
CodeFile="MasterPage.master.vb"
Inherits="MasterPage" %>
<!DOCTYPE
html
PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
and got green underlined 'Master' with two warning messages: 1.Validation (ASP.NET): This attribute name must be followed byan equal (=) sign and a value. If the value is in quotation marks, the quotation marks must match. 2. Validation (ASP.NET): Attribute 'Master' is not a valid attribute of element 'Control'.How I can get rid of the messages?
I have a tag:
<asp:ListItem
CssClass="LabelCSS">Executive</asp:ListItem>
and I am getting the error message
Validation(ASP .Net):Attribute CssClass is not a valid attribute of element ListItem.
What attribute would I use for Css with ListItem?
i'm trying to host an .net framework4.0 application in IIS7. i got an error while clicking on the manage module in modules .like ("Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive. ") .I changed my application poll to .net4.0.I am able to browse my application
</system.serviceModel>
</configuration>
I installed Microsoft Visual Studio 2010 Ultimate Trial and converted existing asp.net 2.0 web application and I am getting this error: znrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive. It's coming from this section in the web.config which was auto-generated by VS2010 when I converted the project:
<compilation defaultLanguage="c#" debug="false" targetFramework="4.0">
<compilers>
<!--<compiler language="c#" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" extension=".cs" compilerOptions="/d:DEBUG;TRACE" /></compilers> -->
<compiler language="c#" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" extension=".cs"/></compilers>
<assemblies>
<add assembly="Microsoft.JScript, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/></assemblies></compilation>
I am developing asp.net mobile application. I am using LINQ to XML to query XML file. I am using the following query to retrieve the name & value of the query dynamically as follows
var TotalManifolds = from MF in FieldRoot.Element("FIELD-DEFINITION").Element("MANIFOLDS").Elements("MANIFOLD")
join SLT in FieldRoot.Element("FIELD-DEFINITION").Element("SLOTS").Elements("SLOT")
on (string)MF.Attribute("MID") equals (string)SLT.Attribute("PARENT")
select new
{
SlotName = (string)SLT.Attribute("NAME").Value,
SlotValue = (string)SLT.Attribute("NAME").Value
};
In the following statement of above query I want to retrive the name of the attribure dynamically without explicitly specifying the name of the attribute SlotName = (string)SLT.Attribute("NAME").Value Here I am explicitly specifying the name. I want to code which can dynamically retrieve the name of the attribute. I am new to Linq to xml. how this can be done programatically? or can you provide me the link through which I can resolve the above issue ?
I am trying to achieve a SSO implimentation across my websites so i am using the machine key attribute to do so.now the trouble starts here as the website the user logs in is on the .net 1.1 framework and the website it it navigating to is .net 4.0.I have share the same machine-key across both the application . It works fine in my testing environment but as i move to the deployment server ,it just dosent work !So what i could do is read this article on MSDN :
http://msdn.microsoft.com/en-us/library/eb0zx8fc.aspx
this tells me to add a domin attribute like below
<forms loginUrl="~Login.aspx" defaultUrl="Default.aspx" protection="All" timeout="80" name=".ASPXAuth" domain="asbc.com"/>
but this thing just dosent work on the 1.1 application and throws an error Unrecognized attribute 'domain'.
Where do i get to mention the domin in my 1.1 application.?
I have an approve button.on clicking on this button it should show that an inactive value is present .Onclicking yes conformation it should save the data or else clicking on no conformation should return false; how i will do that?After alert it always submit the data.
protected void ibtApprove_Click(object sender, ImageClickEventArgs e)
{
string otherAffiliateName = txtRequestedAffiliate.Text;
int inActiveAffiliates = new BLRating().InActiveAAffiliateChecking(otherAffiliateName);
if (inActiveAffiliates > 0)
[code]...
This is the code i used.how i wiil stay back on Confirm 'no' click?
I am writing unit tests for fluent Nhibernate, when I run the test in isloation it passes, but when I run multiple tests. or run the test more than once it starts failing with the message below System.ApplicationException : For property 'Id' expected '1' of type 'System.Int32' but got '2' of type 'System.Int32'
[TextFixture]
public void Can_Correctly_Map_Entity()
{
new PersistenceSpecification<UserProfile>(Session)
.CheckProperty(c => c.Id, 1)
.CheckProperty(c => c.UserName, "user")
.CheckProperty(c => c.Address1, "Address1")
.CheckProperty(c => c.Address2, "Address2")
}
In Visual Studio 2008 I have a Class Library project (called Media) to which I added a Web Reference (not a Service Reference) to a third-party web service (wsdl). In the Class Library project a proxy class is created for using the service along with several classes for the types used in that service.
I also have a second Class Library (called Sync) that references the first one. And then I have a Web Site project that references the second class library. All of this is .NET 3.5
So Web Site > Class Library (Sync) > Class Library with web service reference (Media)
I want to step into the generated code, so I fire up the web site in IIS 7.5 and trigger the call to a method in the second class library (Sync) that in turn should call the web service proxy. I was fully expecting to hit the breakpoint, but instead got an exception:
Unable to generate a temporary class(result=1). error CS0029: Cannotimplicitly convert type Media.WebService.multiValuedAttribute to Media.WebService.multiValuedAttribute[]
Why is ASP.NET trying to generate a temporary class? Don't I already have the generated class from the first Class Library (Media)?
I have been trying to get the data display on the datagrid after selecting a customer.
With the same connection it populates the selection right. But just do not seem to extract the following SQL.
The litABC is to check the flow of control.
There is no syntax error but in the debug menu,
I got A first chance exception of type 'System.Data.Odbc.OdbcException' occurred in System.
Where did I do wrong?
[code]....
I have a project that it had been developed under MVC1 and after aa few months ago I upgraded it in MVC2.
Everything was well, uppon the day I needed to format my computer.
And what can goes wrong with a format? I don't know
I have installed the MVC2, I build the project, no error displayed, but from the time I've uploaded the project in the production server
I am getting this error.
Method not found: 'System.Web.Mvc.MvcHtmlString System.Web.Mvc.Html.LinkExtensions.RouteLink(System.Web.Mvc.HtmlHelper, System.String, System.Object)'.
I can't understand what caused the problem.
Certainly I assumed that is have to do with MVC1 and I referenced it, but with no luck
again.
Theese are the methods that the problem is came from
[Code]....
i have installed ajax control kit successfully and all controls already came in toolbar tab named "Ajax Control toolkit"But when i try to design any page using with ajax control toolkit, follow error is coming:
Could not load type 'System.Web.UI.ScriptReferenceBase' from assembly 'System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.TypeLoadException: Could not load type 'System.Web.UI.ScriptReferenceBase' from assembly 'System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Source Error:[Code]....
Stack Trace: [Code]....
[TypeLoadException: Could not load type 'System.Web.UI.ScriptReferenceBase' from assembly 'System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.]
AjaxControlToolkit.ToolkitScriptManager.OnResolveScriptReference(ScriptReferenceEventArgs e) in [code]...
I am using VIsual Studio 2008 , framework 3.5 but i don't know why in error information version is showing 2.0
i install tool kit according 3.5 framework.also note, framework built-in ajax tags i can use fine and they work properly.
Can anyone tell me the differnce between
System.web.httpcontext.current.application["tag"]
or
System.Configuration.Appsettings["tag"]
I am attempting to use SqlBulkCopy to import data from an XML document. I receive the following error when executing WriteToServer: Invalid cast from 'System.String' to 'System.Guid'
View 1 Replies