使用vs.net,新建C#asp,net web 应用程序项目,总是提示http://1.1 500 internal server error为什么?

yaozhg 2005-10-29 09:30:39
请大家帮忙一下了,弄了整个晚上都搞不好。

系统是win2003 已经装了IIS,还有frontpage扩展(应该是,我选装了)

我在IIS上设了一个127.0.0.1的站点。asp.net在IIS已经勾了允许,。


在新建那个项目时,C#--asp.net web 应用程序 后,在下面的位置我输入http://127.0.0.1或http://localhost都不行,有时他会自动加上webapplicationl在后面,不过也是不行。


请教大家问题出在那里?,
如果有有类似经常或做了没问题的,请把步骤告诉我。谢谢各位。。。不会的帮忙帮顶一下,急。
...全文
135 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
中国小蛇 2005-11-02
  • 打赏
  • 举报
回复
可以看看是不是下面的问题:
1、找到你项目所在的目录,一般是C:\Inetpub\wwwroot\XXX
2、选中XXX目录后,点击右键,查看属性。
3、点击属性中的“WEB共享”标签。
4、如果其中的单选框是在“不共享这个文件夹”,那么就选“共享这个文件夹”,会提示输入别名。用默认名字即可。然后点击确认就可以了。
5、注意一点:如果你建了多个“网站”,要在上面的列表中选择你需要的正确的“站点”名称。

我出的问题就是这样解决的。不知和你的症状是否一样,可以一试。
是英文的,全面包含了c#的各方面。是非常好的一本书,绝对值得下载。 Introduction xxvii Part I: The C# Language 1 Chapter 1: .NET Architecture 3 The Relationship of C# to .NET 4 The Common Language Runtime 4 Advantages of Managed Code 4 A Closer Look at Intermediate Language 7 Support for Object Orientation and Interfaces 8 Distinct Value and Reference Types 9 Strong Data Typing 9 Error Handling with Exceptions 16 Use of Attributes 17 Assemblies 17 Private Assemblies 18 Shared Assemblies 19 Reflection 19 .NET Framework Classes 19 Namespaces 21 Creating .NET Applications Using C# 21 Creating ASP.NET Applications 21 Creating Windows Forms 24 Windows Services 24 The Role of C# in the .NET Enterprise Architecture 24 Summary 26 Chapter 2: C# Basics 29 Before We Start 30 Our First C# Program 30 The Code 30 Compiling and Running the Program 31 Contents A Closer Look 31 Variables 34 Initialization of Variables 34 Variable Scope 35 Constants 38 Predefined Data Types 39 Value Types and Reference Types 39 CTS Types 40 Predefined Value Types 41 Predefined Reference Types 44 Flow Control 47 Conditional Statements 47 Loops 51 Jump Statements 54 Enumerations 55 Arrays 57 Namespaces 58 The using Statement 59 Namespace Aliases 60 The Main() Method 61 Multiple Main() Methods 61 Passing Arguments to Main() 62 More on Compiling C# Files 63 Console I/O 65 Using Comments 67 Internal Comments Within the Source Files 67 XML Documentation 68 The C# Preprocessor Directives 70 #define and #undef 70 #if, #elif, #else, and #endif 71 #warning and #error 72 #region and #endregion 72 #line 72 C# Programming Guidelines 73 Rules for Identifiers 73 Usage Conventions 74 Summary 81 Chapter 3: Objects and Types 83 Classes and Structs 84 Class Members 85 Data Members 85 Function Members 85 xi Contents readonly Fields 99 Structs 101 Structs Are Value Types 102 Structs and Inheritance 103 Constructors for Structs 103 The Object Class 104 System.Object Methods 104 The ToString() Method 105 Summary 107 Chapter 4: Inheritance 109 Types of Inheritance 109 Implementation Versus Interface Inheritance 109 Multiple Inheritance 110 Structs and Classes 110 Implementation Inheritance 111 Virtual Methods 112 Hiding Methods 113 Calling Base Versions of Functions 114 Abstract Classes and Functions 115 Sealed Classes and Methods 115 Constructors of Derived Classes 116 Modifiers 122 Visibility Modifiers 122 Other Modifiers 123 Interfaces 123 Defining and Implementing Interfaces 125 Derived Interfaces 128 Summary 130 Chapter 5: Operators and Casts 131 Operators 131 Operator Shortcuts 133 The Ternary Operator 134 The checked and unchecked Operators 134 The is Operator 135 The as Operator 136 The sizeof Operator 136 The typeof Operator 136 Contents Operator Precedence 137 Type Safety 137 Type Conversions 138 Boxing and Unboxing 141 Comparing Objects for Equality 142 Comparing Reference Types for Equality 142 The ReferenceEquals() Method 142 The virtual Equals() Method 143 The static Equals() Method 143 Comparison Operator (==) 143 Comparing Value Types for Equality 143 Operator Overloading 144 How Operators Work 145 Operator Overloading Example: The Vector Struct 146 Which Operators Can You Overload? 153 User-Defined Casts 154 Implementing User-Defined Casts 155 Multiple Casting 161 Summary 165 Chapter 6: Delegates and Events 167 Delegates 167 Using Delegates in C# 169 SimpleDelegate Example 172 BubbleSorter Example 174 Multicast Delegates 177 Events 179 The Receiver’s View of Events 180 Generating Events 182 Summary 186 Chapter 7: Memory Management and Pointers 187 Memory Management under the Hood 187 Value Data Types 188 Reference Data Types 190 Garbage Collection 192 Freeing Unmanaged Resources 193 Destructors 193 The IDisposable Interface 195 xiii Contents Implementing IDisposable and a Destructor 196 Unsafe Code 197 Pointers 198 Pointer Example: PointerPlayaround 207 Using Pointers to Optimize Performance 212 Summary 216 Chapter 8: Strings and Regular Expressions 217 System.String 218 Building Strings 219 Format Strings 223 Regular Expressions 229 Introduction to Regular Expressions 229 The RegularExpressionsPlayaround Example 230 Displaying Results 233 Matches, Groups, and Captures 234 Summary 237 Chapter 9: Collections 239 Examining Groups of Objects 239 Array Lists 240 Collections 241 Dictionaries 245 Summary 256 Chapter 10: Reflection 257 Custom Attributes 258 Writing Custom Attributes 258 Custom Attribute Example: WhatsNewAttributes 262 Reflection 265 The System.Type Class 266 The TypeView Example 268 The Assembly Class 271 Completing the WhatsNewAttributes Sample 272 Summary 276 Contents Chapter 11: Errors and Exceptions 277 Looking into Errors and Exception Handling 277 Exception Classes 278 Catching Exceptions 280 User-Defined Exception Classes 290 Summary 297 Part II: The .NET Environment 299 Chapter 12: Visual Studio .NET 301 Working with Visual Studio .NET 2003 301 Creating a Project 304 Solutions and Projects 311 Windows Application Code 314 Reading in Visual Studio 6 Projects 314 Exploring and Coding a Project 315 Building a Project 326 Debugging 331 Other .NET Tools 334 The ASP.NET Web Matrix Project 335 WinCV 335 Summary 337 Chapter 13: Assemblies 339 What Are Assemblies? 339 The Answer to DLL Hell 340 Features of Assemblies 341 Application Domains and Assemblies 341 Assembly Structure 344 Assembly Manifests 346 Namespaces, Assemblies, and Components 346 Private and Shared Assemblies 347 Viewing Assemblies 347 Building Assemblies 348 Cross-Language Support 353 The CTS and the CLS 353 Language Independence in Action 354 CLS Requirements 364 xv Contents Global Assembly Cache 366 Native Image Generator 366 Global Assembly Cache Viewer 367 Global Assembly Cache Utility (gacutil.exe) 368 Creating Shared Assemblies 369 Shared Assembly Names 369 Creating a Shared Assembly 371 Configuration 376 Configuration Categories 376 Versioning 377 Configuring Directories 387 Summary 390 Chapter 14: .NET Security 391 Code Access Security 392 Code Groups 393 Code Access Permissions and Permissions Sets 399 Policy Levels: Machine, User, and Enterprise 403 Support for Security in the Framework 405 Demanding Permissions 406 Requesting Permissions 407 Implicit Permission 410 Denying Permissions 411 Asserting Permissions 412 Creating Code Access Permissions 414 Declarative Security 414 Role-Based Security 415 The Principal 415 Windows Principal 416 Roles 417 Declarative Role-Based Security 418 Managing Security Policy 419 The Security Configuration File 419 Managing Code Groups and Permissions 423 Turning Security On and Off 423 Resetting Security Policy 423 Creating a Code Group 423 Deleting a Code Group 424 Changing a Code Group’s Permissions 424 Creating and Applying Permissions Sets 425 Distributing Code Using a Strong Name 427 Contents Distributing Code Using Certificates 429 Managing Zones 435 Summary 437 Chapter 15: Threading 439 Threading 439 Applications with Multiple Threads 441 Manipulating Threads 441 The ThreadPlayaround Sample 444 Thread Priorities 448 Synchronization 449 Summary 453 Chapter 16: Distributed Applications with .NET Remoting 455 What Is .NET Remoting? 456 Application Types and Protocols 456 CLR Object Remoting 457 .NET Remoting Overview 457 Contexts 460 Activation 461 Attributes and Properties 461 Communication between Contexts 462 Remote Objects, Clients, and Servers 462 Remote Objects 462 A Simple Server 464 A Simple Client 465 .NET Remoting Architecture 466 Channels 466 Formatters 470 ChannelServices and RemotingConfiguration 471 Object Activation 472 Message Sinks 476 Passing Objects in Remote Methods 476 Lifetime Management 481 Miscellaneous .NET Remoting Features 484 Configuration Files 484 Hosting Applications 494 Classes, Interfaces, and SoapSuds 495 Asynchronous Remoting 498 Remoting and Events 499 Call Contexts 505 Summary 507 xvii Contents Chapter 17: Localization 509 Namespace System.Globalization 510 Unicode Issues 510 Cultures and Regions 511 Cultures in Action 516 Sorting 520 Resources 522 Creating Resource Files 522 ResGen 523 ResourceWriter 523 Using Resource Files 524 The System.Resources Namespace 527 Localization Example Using Visual Studio .NET 527 Outsourcing Translations 533 Changing the Culture Programmatically 534 Using Binary Resource Files 536 Using XML Resource Files 537 Automatic Fallback for Resources 539 Globalization and Localization with ASP.NET 539 A Custom Resource Reader 540 Creating a DatabaseResourceReader 541 Creating a DatabaseResourceSet 542 Creating a DatabaseResourceManager 543 Client Application for DatabaseResourceReader 544 Summary 544 Chapter 18: Deployment 545 Designing for Deployment 545 Deployment Options 546 Xcopy 546 Copy Project 546 Deployment Projects 546 Deployment Requirements 546 Simple Deployment 547 Xcopy 548 Xcopy and Web Applications 548 Copy Project 550 Installer Projects 551 What Is Windows Installer? 551 Creating Installers 552 Advanced Options 562 Summary 569 Contents Part III: Windows Forms 571 Chapter 19: Windows Forms 573 Creating a Windows Form Application 574 Control Class 579 Size and Location 580 Appearance 580 User Interaction 580 Windows Functionality 582 Miscellaneous Functionality 582 Class Hierarchy 582 Standard Controls and Components 584 Forms 598 Form Class 599 Multiple Document Interface (MDI) 607 Custom Controls 610 Summary 622 Chapter 20: Graphics with GDI+ 623 Understanding Drawing Principles 624 GDI and GDI+ 624 Drawing Shapes 626 Painting Shapes Using OnPaint() 629 Using the Clipping Region 630 Measuring Coordinates and Areas 632 Point and PointF 632 Size and SizeF 634 Rectangle and RectangleF 635 Region 636 A Note about Debugging 637 Drawing Scrollable Windows 638 World, Page, and Device Coordinates 644 Colors 645 Red-Green-Blue (RGB) Values 645 The Named Colors 646 Graphics Display Modes and the Safety Palette 646 The Safety Palette 647 Pens and Brushes 648 Brushes 648 Pens 649 xix Contents Drawing Shapes and Lines 650 Displaying Images 652 Issues When Manipulating Images 655 Drawing Text 655 Simple Text Example 656 Fonts and Font Families 657 Example: Enumerating Font Families 659 Editing a Text Document: The CapsEditor Sample 661 The Invalidate() Method 666 Calculating Item Sizes and Document Size 667 OnPaint() 668 Coordinate Transforms 670 Responding to User Input 671 Printing 675 Implementing Print and Print Preview 676 Summary 680 Part IV: Data 683 Chapter 21: Data Access with .NET 685 ADO.NET Overview 685 Namespaces 686 Shared Classes 686 Database-Specific Classes 687 Using Database Connections 688 Using Connections Efficiently 689 Transactions 692 Commands 693 Executing Commands 694 Calling Stored Procedures 698 Fast Data Access: The Data Reader 701 Managing Data and Relationships: The DataSet Class 704 Data Tables 704 Data Columns 705 Data Relationships 711 Data Constraints 713 XML Schemas 715 Generating Code with XSD 716 Populating a DataSet 721 Populating a DataSet Class with a Data Adapter 722 Populating a DataSet from XML 723 xx Contents Persisting DataSet Changes 723 Updating with Data Adapters 724 Writing XML Output 726 Working with ADO.NET 728 Tiered Development 728 Key Generation with SQL Server 730 Naming Conventions 732 Summary 734 Chapter 22: Viewing .NET Data 735 The DataGrid Control 735 Displaying Tabular Data 735 Data Sources 738 DataGrid Class Hierarchy 746 Data Binding 750 Simple Binding 750 Data-Binding Objects 751 Visual Studio.NET and Data Access 757 Creating a Connection 758 Selecting Data 759 Generating a DataSet 762 Updating the Data Source 763 Building a Schema 764 Other Common Requirements 770 Summary 778 Chapter 23: Manipulating XML 781 XML Standards Support in .NET 782 Introducing the System.Xml Namespace 782 Using MSXML in .NET 783 Using System.Xml Classes 786 Reading and Writing Streamed XML 786 Using the XmlTextReader Class 787 Using the XmlValidatingReader Class 791 Using the XmlTextWriter Class 794 Using the DOM in .NET 795 Using the XmlDocument Class 797 Using XPath and XSLT in .NET 802 The System.Xml.XPath Namespace 803 The System.Xml.Xsl Namespace 807 Contents XML and ADO.NET 812 Converting ADO.NET Data to XML 812 Converting XML to ADO.NET Data 820 Reading and Writing a DiffGram 822 Serializing Objects in XML 825 Serialization without Source Code Access 833 Summary 836 Chapter 24: Working with Active Directory 837 The Architecture of Active Directory 838 Features 838 Active Directory Concepts 839 Characteristics of Active Directory Data 843 Schema 843 Administration Tools for Active Directory 845 Active Directory Users and Computers 845 ADSI Edit 846 Active Directory Service Interfaces (ADSI) 847 Programming Active Directory 848 Classes in System.DirectoryServices 849 Binding 849 Getting Directory Entries 854 Object Collections 855 Cache 857 Creating New Objects 857 Updating Directory Entries 858 Accessing Native ADSI Objects 859 Searching in Active Directory 860 Searching for User Objects 864 User Interface 864 Get the Schema Naming Context 864 Get the Property Names of the User Class 866 Search for User Objects 867 Summary 869 Part V: Web Programming 871 Chapter 25: ASP.NET Pages 873 ASP.NET Introduction 874 State Management in ASP.NET 875 xxii Contents ASP.NET Web Forms 875 ASP.NET Server Controls 880 ADO.NET and Data Binding 892 Updating the Event-Booking Application 893 More on Data Binding 901 Application Configuration 906 Summary 907 Chapter 26: Web Services 909 SOAP 910 WSDL 911 Web Services 913 Exposing Web Services 913 Consuming Web Services 916 Extending the Event-Booking Example 918 The Event-Booking Web Service 919 The Event-Booking Client 922 Exchanging Data Using SOAP Headers 924 Summary 929 Chapter 27: User Controls and Custom Controls 931 User Controls 932 A Simple User Control 932 Custom Controls 939 Custom Control Project Configuration 940 Basic Custom Controls 944 Creating a Composite Custom Control 949 A Straw Poll Control 951 The Candidate Controls 953 The StrawPoll Control Builder 954 Straw Poll Style 955 The Straw Poll Control 956 Summary 962 Part VI: Interop 963 Chapter 28: COM Interoperability 965 .NET and COM 966 Metadata 966 Freeing Memory 966 xxiii Contents Interfaces 967 Method Binding 969 Data Types 969 Registration 969 Threading 969 Error Handling 971 Event Handling 972 Marshaling 972 Using a COM Component from a .NET Client 973 Creating a COM Component 973 Creating a Runtime Callable Wrapper 977 Threading Issues 980 Adding Connection Points 980 Using ActiveX Controls in Windows Forms 982 Using COM Objects from within ASP.NET 985 Using a .NET Component from a COM Client 985 COM Callable Wrapper 986 Creating a .NET Component 986 Creating a Type Library 987 COM Interop Attributes 989 COM Registration 992 Creating a COM Client 993 Adding Connection Points 995 Creating a Client with a Sink Object 996 Running Windows Forms Controls in Internet Explorer 997 Summary 998 Chapter 29: Enterprise Services 999 Overview 999 History 999 Where to Use Enterprise Services? 1000 Contexts 1001 Automatic Transactions 1001 Distributed Transactions 1001 Object Pooling 1002 Role-based Security 1002 Queued Components 1002 Loosely Coupled Events 1002 Creating a Simple COM+ Application 1003 Class ServicedComponent 1003 Application Attributes 1003 Creating the Component 1004 Contents Deployment 1005 Automatic Deployment 1005 Manual Deployment 1005 Component Services Admin Tool 1006 Client Application 1008 Transactions 1009 ACID Properties 1009 Transaction Attributes 1009 Transaction Results 1010 Sample Application 1011 Summary 1021 Part VII: Windows Base Services 1023 Chapter 30: File and Registry Operations 1025 Managing the File System 1026 .NET Classes That Represent Files and Folders 1027 The Path Class 1029 Example: A File Browser 1030 Moving, Copying, and Deleting Files 1035 Example: FilePropertiesAndMovement 1035 Reading and Writing to Files 1039 Streams 1040 Reading and Writing to Binary Files 1042 Reading and Writing to Text Files 1047 Reading and Writing to the Registry 1054 The Registry 1055 The .NET Registry Classes 1057 Example: SelfPlacingWindow 1059 Summary 1066 Chapter 31: Accessing the Internet 1067 The WebClient Class 1068 Downloading Files 1068 Basic Web Client Example 1068 Uploading Files 1070 WebRequest and WebResponse Classes 1070 Other WebRequest and WebResponse Features 1071 Displaying Output as an HTML Page 1074 The Web Request and Web Response Hierarchy 1075 xxv Contents Utility Classes 1077 URIs 1077 IP Addresses and DNS Names 1079 Lower-Level Protocols 1082 Lower-Level Classes 1083 Summary 1088 Chapter 32: Windows Services 1091 What Is a Windows Service? 1091 Windows Services Architecture 1093 Service Program 1093 Service Control Program 1095 Service Configuration Program 1095 System.ServiceProcess Namespace 1095 Creating a Windows Service 1096 A Class Library Using Sockets 1096 TcpClient Example 1100 Windows Service Project 1102 Threading and Services 1107 Service Installation 1107 Installation Program 1108 Monitoring and Controlling the Service 1113 MMC Computer Management 1114 net.exe 1114 sc.exe 1115 Visual Studio .NET Server Explorer 1116 ServiceController Class 1116 Troubleshooting 1122 Interactive Services 1123 Event Logging 1123 Performance Monitoring 1130 Power Events 1135 Summary 1135 At www.wrox.com Appendix A: Principles of Object-Oriented Programming 1137 Appendix B: C# for Visual Basic 6 Developers 1177 Appendix C: C# for Java Developers 1225 Appendix D: C# for C++ Developers 1253 Index 1307
【面试题库网整理 .net 面试题(附答案)(四)】 7. 某一密码仅使用K、L、M、N、O共5个字母,密码中的单词从左向右排列,密码单词必须遵循如下规则: (1) 密码单词的最小长度是两个字母,可以相同,也可以不同 (2) K不可能是单词的第一个字母 (3) 如果L出现,则出现次数不止一次 (4) M不能使最后一个也不能是倒数第二个字母 (5) K出现,则N就一定出现 (6) O如果是最后一个字母,则L一定出现 问题一:下列哪一个字母可以放在LO中的O后面,形成一个3个字母的密码单词? A) K B)L C) M D) N 答案:B 问题二:如果能得到的字母是K、L、M,那么能够形成的两个字母长的密码单词的总数是多少? A)1个 B)3个 C)6个 D)9个 答案:A 问题三:下列哪一个是单词密码? A) KLLN B) LOML C) MLLO D)NMKO 答案:C 8. 62-63=1 等式不成立,请移动一个数字(不可以移动减号和等于号),使得等式成立,如何移动? 答案:62移动成2的6次方 new有几种用法 第一种:new Class(); 第二种:覆盖方法 public new XXXX(){} 第三种:new 约束指定泛型类声明中的任何类型参数都必须有公共的无参数构造函数。 2.如何把一个array复制到arrayList里 foreach( object o in array )arrayList.Add(o); 3.datagrid.datasouse可以连接什么数据源 [dataset,datatable,dataview] dataset,datatable,dataview , IList 4.概述反射和序列化 反射:程序集包含模块,而模块包含类型,类型又包含成员。反射则提供了封装程序集、模块和类型的对象。您可以使用反射动态地创建类型的实例,将类型绑定到现有对象,或从现有对象中获取类型。然后,可以调用类型的方法或访问其字段和属性 序列化:序列化是将对象转换为容易传输的格式的过程。例如,可以序列化一个对象,然后使用 HTTP 通过 Internet 在客户端和服务器之间传输该对象。在另一端,反序列化将从该流重新构造对象。 5.概述o/r mapping 的原理 利用反射,配置 将类于数据库表映射 7.用sealed修饰的类有什么特点 sealed 修饰符用于防止从所修饰的类派生出其它类。如果一个密封类被指定为其它类的基类,则会发生编译时错误。 密封类不能同时为抽象类。 sealed 修饰符主要用于防止非有意的派生,但是它还能促使某些运行时优化。具体说来,由于密封类永远不会有任何派生类,所以对密封类的实例的虚拟函数成员的调用可以转换为非虚拟调用来处理。 11.详述.NET里class和struct的异同! class:放在 ? struct放在? struct值传递 类与结构有很多相似之处:结构可以实现接口,并且可以具有与类相同的成员类型。然而,结构在几个重要方面不同于类:结构为值类型而不是引用类型,并且结构不支持继承。结构的值存储在“在堆栈上”或“内联”。细心的程序员有时可以通过聪明地使用结构来增强性能。 12.概述.NET里对 remoting 和 webservice 两项技术的理解和实际中的应用。 远程逻辑调用,remoing接口只能用在.net中 13.什么是code-behind技术 aspx and cs 14.概述三层结构体系 web/business/dataaccess 15.asp.net如何实现MVC模式,举例说明! web/business/dataaccess 2.什么是ASP.net中的用户控件 答:用户控件就是.ascx扩展名的东西喽,可以拖到不同的页面中调用,以节省代码.比如登陆可能在多个页面上有,就可以做成用户控件,但是有一个问题就是用户控件拖到不同级别的目录下后里面的图片等的相对路径会变得不准确,需要自已写方法调整. 3.什么叫应用程序域?什么是受管制的代码?什么是强类型系统?什么是装箱和拆箱?什么是重载?CTS、CLS和CLR分别作何解释? 答:装箱就是把值类型转成引用类型,从MS IL角度看好像是boxing,没记错的话是把值从堆栈转到堆中.拆箱相反,重载就是指一个方法名同,参数个数不同,返回值可以相同的方法.CLR是通用语言运行时,其它的不清楚. 4.列举一下你所了解的XML技术及其应用 答:XML可是好东西,保存配置,站与站之间的交流,WEB SERVICE都要用它. 5.值类型和引用类型的区别?写出C#的样例代码。 答:结构是值类型,类是引用类型,所以传结构就是值类型的应用啦,传对象或类就是引用类型的,这个不用多写了吧. 6.ADO.net中常用的对象有哪些?分别描述一下。 答:connection command sqladapter dataset datatable dataview等等.写不完了. 7.如何理解委托? 答:据说相当于函数指针,定义了委托就可以在不调用原方法名称的情况下调用那个方法. msdn2005中是这样解释的: 委托具有以下特点: 委托类似于 C++ 函数指针,但它是类型安全的。 委托允许将方法作为参数进行传递。 委托可用于定义回调方法。 委托可以链接在一起;例如,可以对一个事件调用多个方法。 方法不需要与委托签名精确匹配。有关更多信息,请参见协变和逆变。 C# 2.0 版引入了匿名方法的概念,此类方法允许将代码块作为参数传递,以代替单独定义的方法。 【面试题库网整理 .net 面试题(附答案)(三)】 22.您要创建一个显示公司员工列表的应用程序。您使用一个DataGrid控件显示员工的列表。您打算修改这个控件以便在这个Grid的Footer显示员工合计数。请问您应该怎么做?( C? ) A.重写OnPreRender事件,当Grid的Footer行被创建时显示合计数。 B.重写OnItemCreated事件,当Grid的Footer行被创建时显示合计数。 C.重写OnItemDataBound事件,当Grid的Footer行被创建时显示合计数。 D. 重写OnLayout事件,当Grid的Footer行被创建时显示合计数。 23.您要创建ASP.NET应用程序用于运行AllWin公司内部的Web站点,这个应用程序包含了50个页面。您想要配置这个应用程序以便当发生一个HTTP代码错误时它可以显示一个自定义的错误页面给用户。您想要花最小的代价完成这些目标,您应该怎么做?(多选)( CD )   A.在这个应用程序的Global.asax文件中创建一个Application_Error过程去处理ASP.NET代码错误。   B.在这个应用程序Web.config文件中创建一个applicationError节去处理ASP.NET代码错误。   C.在这个应用程序的Global.asax文件中创建一个CustomErrors事件去处理HTTP错误。   D.在这个应用程序Web.config文件中创建一个CustomErrors节去处理HTTP错误。   E.在这个应用程序的每一页中添加一个Page指示符去处理ASP.NET 代码错误。   F. 在这个应用程序的每一页中添加一个Page指示符去处理ASP.NET HTTP错误。 24.您的公司有一个DB Server,名为AllWin,其上装了MS SQLSERVER 2000。现在需要您写一个数据库连接字符串,用以连接AllWin上SQL SERVER中的一个名为PubBase实例的Test库。请问,应该选择下面哪一个字符串?( B )   A. “Server=AllWin;Data Source=PubBase;Initial Catalog=Test;Integrated Security=SSPI”   B. “Server= AllWin;Data Source=PubBase;Database=Test;Integrated Security= SSPI”   C. “Data Source= AllWin \PubBase;Initial Category=PubBase;Integrated Security= SSPI”   D. “Data Source= AllWin \ PubBase;Database=Test;Integrated Security= SSPI” 25.您为AllWin公司创建了一个ASP.NET应用程序。这个应用程序调用一个 Xml Web Service。这个 Xml Web Service 将返回一个包含了公司雇员列表的DataSet对象。请问您该如何在这个程序中使用这个 Xml Web Service?( ? )   A.在“引用”对话框的.Net标签中选择 System.Web.Services.dll。   B.在“Web引用”对话框中输入这个 XML Web service 的地址。   C.在您的 Global.asax.cs 中添加一条 using 语句并指定这个 XML Web service 的地址。   D.在您的 Global.asax.cs 中写一个事件处理器导入这个 Xml Web Service 相应的 .wsdl 和 .disco 文件。 26.您要创建一个ASP.NET应用程序在DataGrid控件中显示一个经过排序的列表。产品数据被存放于一个名为PubBase的Microsoft SQL Server 数据库。每个产品的主键是ProductID,Numeric型并且每个产品有一个字母描述字段,名为ProductName。您使用一个SqlDataAdapter对象和一个SqlCommand对象通过调用一个存储过程从数据库中获取产品数据。您将SqlCommand对象的CommandType属性设置为CommandType.StoredProcedure,并将它的CommandText属性设置为procProductList。您成功的获取了一个DataTable对象,其中是已经按ProductID降序排列的产品列表。您打算显示以相反的字母顺序排列的ProductName,请问该怎么做? ( B )   A. 将SqlCommand对象的CommandType属性修改为CommandType.Text,将CommandText属性修改为”SELECT * FROM procProductList ORDER BY ProductName DESC”。然后将这个DataTable对象绑定到DataGrid控件。   B. 创建一个基于这个DataTable对象的新的DataView并将这个DataView的Sort属性设置为“ProductName DESC”。然后将这个DataView对象绑定到DataGrid控件。   C. 将DataGrid控件的AllowSorting属性设置为True,并将DataGridColumn的SortExpression属性设置为 “ProductName DESC”.以显示ProductName。然后将这个DataTable对象绑定到DataGrid控件。   D. 将DataTable对象的DisplayExpression属性设置为 “ORDER BY ProductName DESC”.。然后将这个DataTable对象绑定到DataGrid控件。 76.C#代码实现,确保windows程序只有一个实例(instance) /// ///应用程序的主入口点。 /// [STAThread] staticvoid Main() { //防止程序多次运行 if(!OneInstance.IsFirst("GetPayInfo")) { MessageBox.Show ("警告:程序正在运行中! 请不要重复打开程序!可在右下角系统栏找到!","程序错误提示:",MessageBoxButtons.OK,MessageBoxIcon.Stop); return; } Application.Run(new Form1()); } // ******************* 防止程序多次执行 ************************** publicabstractclass OneInstance { /// ///判断程序是否正在运行 /// ///程序名称 ///如果程序是第一次运行返回True,否则返回False publicstaticbool IsFirst(string appId) { bool ret=false; if(OpenMutex(0x1F0001,0,appId)==IntPtr.Zero) { CreateMutex(IntPtr.Zero,0,appId); ret=true; } return ret; } [DllImport("Kernel32.dll",CharSet=CharSet.Auto)] privatestaticextern IntPtr OpenMutex( uint dwDesiredAccess, // access int bInheritHandle, // inheritance option string lpName // object name ); [DllImport("Kernel32.dll",CharSet=CharSet.Auto)] privatestaticextern IntPtr CreateMutex( IntPtr lpMutexAttributes, // SD int bInitialOwner, // initial owner string lpName // object name ); } 【面试题库网整理 .net 面试题(附答案)(二)】 8.以下代码段中能否编译通过?请给出理由。 try { } catch(FileNotFoundException e1) { } catch(Exception e2) { } catch(IOException e3) { } catch { } 9.对于一个实现了IDisposable接口的类,以下哪些项可以执行与释放或重置非托管资源相关的应用程序定义的任务?(多选) ( ABC ) A.Close B.DisposeC.Finalize D.using E.Quit 10.Net依赖以下哪项技术实现跨语言互用性?( C ) A.CLR B.CTS C.CLS D.CTT 11.请问: String类与StringBuilder类有什么区别?为什么在.Net类库中要同时存在这2个类?(简答) 如果要操作一个不断增长的字符串,尽量不用String类,改用StringBuilder类。两个类的工作原理不同:String类是一种传统的修改字符串的方式,它确实可以完成把一个字符串添加到另一个字符串上的工作没错,但是在.NET框架下,这个操作实在是划不来。因为系统先是把两个字符串写入内存,接着删除原来的String对象,然后创建一个String对象,并读取内存中的数据赋给该对象。这一来二去的,耗了不少时间。而使用System.Text命名空间下面的StringBuilder类就不是这样了,它提供的Append方法,能够在已有对象的原地进行字符串的修改,简单而且直接。当然,一般情况下觉察不到这二者效率的差异,但如果你要对某个字符串进行大量的添加操作,那么StringBuilder类所耗费的时间和String类简直不是一个数量级的。 12.以下哪个类是int的基类?( ) A.Int32 B.Object C.ValueType D.Int16 二、C# 部分* 13.以下哪些可以作为接口成员? (多选) ( ABDE ) A.方法B.属性C.字段D.事件E.索引器 F.构造函数G.析构函数 14.以下关于ref和out的描述哪些项是正确的?(多选) ( ACD ) A.使用ref参数,传递到ref参数的参数必须最先初始化。 B.使用out参数,传递到out参数的参数必须最先初始化。 C.使用ref参数,必须将参数作为ref参数显式传递到方法。 D.使用out参数,必须将参数作为out参数显式传递到方法。 15.“访问范围限定于此程序或那些由它所属的类派生的类型”是对以下哪个成员可访问性含义的正确描述?( B ) A.public B.protected C.internal D.protected internal 16.class Class1 { private static int count = 0; static Class1() { count++; } public Class1() { count++; } } Class1 o1 = new Class1(); Class1 o2 = new Class1(); 请问,o1.Count的值是多少?( C ) A.1 B.2 C.3 D.4 17.abstract class BaseClass { public virtual void MethodA() { } public virtual void MethodB() { } } class Class1: BaseClass { public void MethodA(string arg) { } public override void MethodB() { } } class Class2: Class1 { new public void MethodB() { } } class MainClass { public static void Main(string[] args) { Class2 o = new Class2(); Console.WriteLine(o.MethodA()); } } 请问,o.MethodA调用的是: ( A ) A.BaseClass.MethodAB.Class2.MethodA C.Class1.MethodAD.都不是 【.net 面试题系列文章一(附答案)】 1 (1)面向对象的语言具有__继承性_性、_封装性_性、_多态性 性。 (2)能用foreach遍历访问的对象需要实现 _ IEnumerable 接口或声明_ GetEnumerator 方法的类型。1.c#中的三元运算符是__?:__ 2.当整数a赋值给一个object对象时,整数a将会被__装箱___? 3.类成员有__3__种可访问形式? 4.public static const int A=1;这段代码有错误么?是什么? const成员都是static所以应该去掉static 5.float f=-123.567F; int i=(int)f; i的值现在是_-123____? 6.利用operator声明且仅声明了==,有什么错误么? 要同时修改Equale和GetHash() ? 重载了"==" 就必须重载 "!=" 7.委托声明的关键字是___ delegate ___? 8.用sealed修饰的类有什么特点?不可被继承 9.在Asp.net中所有的自定义用户控件都必须继承自_ System.Web.UI.UserControl _______? 10.在.Net中所有可序列化的类都被标记为__[serializable]___? 11.在.Net托管代码中我们不用担心内存漏洞,这是因为有了_ gC __? 12.下面的代码中有什么错误吗?_ abstract override 是不可以一起修饰______ using System; class A { public virtual void F(){ Console.WriteLine("A.F"); } } abstract class B:A { public abstract override void F(); } 13.当类T只声明了私有实例构造函数时,则在T的程序文本外部,_不可以_(可以 or 不可以)从T派生出新的类,_不可以_(可以 or 不可以)直接创建T的任何实例。 14.下面这段代码有错误么?case():不行 default; switch (i){ case(): CaseZero(); break; case 1: CaseOne(); break; case 2: dufault; CaseTwo(); break; } 15.在.Net中,类System.Web.UI.Page 可以被继承么?可以
Get the in-depth architectural information you need about the hottest OOP language for Microsoft® .NET—now updated for final release code.Take a detailed look at the internal architecture of the groundbreaking C# language with this architectural reference. It’s fully updated with information about the Microsoft® .NET platform and Microsoft Visual Studio® .NET. It’s packed with sample code and demo applications to show you exactly how to develop with C#. You’ll explore this advanced language and its design parameters and construction to gain a complete understanding of how it works—and why it works that way. Topics covered include:C# CLASS FUNDAMENTALS• Building C# applications and libraries• The .NET type system• Classes and structs• Methods, properties, arrays, indexers, and attributes• Interfaces WRITING CODE • Expressions and operators • Program flow control• String handling and regular expressions • File I/O with streams • Error handling with exceptions • Operator overloading and user-defined conversions • Delegates and event handlers• Documentation with XML ADVANCED C#• Numerical processing and the Math class• Collections and object enumeration • Multithreaded programming• Querying metadata with reflection • Deterministic finalization and the Dispose pattern • Pinning and memory management • Using COM from C# applications • .NET components in unmanaged code• Incorporating securityCD-ROM FEATURES:• A fully searchable electronic copy of the book• Sample code in C# (also available at www.microsoft.com/mspress/books/5861.asp)

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧